diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-10 20:12:55 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-10 20:12:55 -0400 |
commit | 83a9abc9d683cd8be848d8e49020bf1f02f55319 (patch) | |
tree | a88440e1e88740b0cfe3c724fc07dda179578d55 /config | |
parent | a6ace0db337948e940dfa430e780edccf25eabc9 (diff) | |
parent | 12aaa903878958505d29284ac4d0d6605ba71c48 (diff) | |
download | donetick-83a9abc9d683cd8be848d8e49020bf1f02f55319.tar.gz donetick-83a9abc9d683cd8be848d8e49020bf1f02f55319.tar.bz2 donetick-83a9abc9d683cd8be848d8e49020bf1f02f55319.zip |
Merge branch 'dev'
Diffstat (limited to '')
-rw-r--r-- | config/config.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/config/config.go b/config/config.go index f89527c..f17a0eb 100644 --- a/config/config.go +++ b/config/config.go @@ -93,9 +93,14 @@ func NewConfig() *Config { }, } } - +func configEnvironmentOverrides(Config *Config) { + if os.Getenv("DONETICK_TELEGRAM_TOKEN") != "" { + Config.Telegram.Token = os.Getenv("DONETICK_TELEGRAM_TOKEN") + } +} func LoadConfig() *Config { - // read evniroment variable FORWARD_ENV and see if it's equal local then load local (config/local.yaml) using viper: + // set the config name based on the environment: + if os.Getenv("CA_ENV") == "local" { viper.SetConfigName("local") } else if os.Getenv("CA_ENV") == "prod" { @@ -120,7 +125,7 @@ func LoadConfig() *Config { panic(err) } fmt.Printf("--ConfigLoad name : %s ", config.Name) - + configEnvironmentOverrides(&config) return &config // return LocalConfig() |