aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-09-10 17:33:54 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2024-09-10 17:33:54 +0100
commit9d04ff6a4d1dde541a0253e0db59957c69fec4cf (patch)
tree70c7f9a2e6b64eef21e5efe78012d2e3261f4de0 /config
parent6fb41ab9b491a257b027bf8a3c8a0828dc681b9a (diff)
downloaddonetick-main.tar.gz
donetick-main.tar.bz2
donetick-main.zip
WIP: genericize notifier as interfaceHEADmain
Diffstat (limited to '')
-rw-r--r--config/config.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/config/config.go b/config/config.go
index 52ed1db..139687d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -10,7 +10,7 @@ import (
type Config struct {
Name string `mapstructure:"name" yaml:"name"`
- Telegram TelegramConfig `mapstructure:"telegram" yaml:"telegram"`
+ Notifiers NotifiersConfig `mapstructure:"notifiers" yaml:"notifiers"`
Database DatabaseConfig `mapstructure:"database" yaml:"database"`
Jwt JwtConfig `mapstructure:"jwt" yaml:"jwt"`
Server ServerConfig `mapstructure:"server" yaml:"server"`
@@ -20,6 +20,10 @@ type Config struct {
IsDoneTickDotCom bool `mapstructure:"is_done_tick_dot_com" yaml:"is_done_tick_dot_com"`
}
+type NotifiersConfig struct {
+ Telegram TelegramConfig `mapstructure:"telegram" yaml:"telegram"`
+}
+
type TelegramConfig struct {
Token string `mapstructure:"token" yaml:"token"`
}
@@ -80,9 +84,6 @@ type EmailConfig struct {
func NewConfig() *Config {
return &Config{
- Telegram: TelegramConfig{
- Token: "",
- },
Database: DatabaseConfig{
Type: "sqlite",
Migration: true,
@@ -96,7 +97,7 @@ func NewConfig() *Config {
}
func configEnvironmentOverrides(Config *Config) {
if os.Getenv("DONETICK_TELEGRAM_TOKEN") != "" {
- Config.Telegram.Token = os.Getenv("DONETICK_TELEGRAM_TOKEN")
+ Config.Notifiers.Telegram.Token = os.Getenv("DONETICK_TELEGRAM_TOKEN")
}
}
func LoadConfig() *Config {