fix(config): env var prefix clashing in k8s (#937)

* fix: log config error

* fix: add extra underscore to env prefix

* fix: config revert

* chore: add web/.gitkeep

* chore: fix web/dist/.gitkeep

* fix: add extra underscore to env prefix
This commit is contained in:
ze0s 2023-05-16 00:46:28 +02:00 committed by GitHub
parent 6898ad8315
commit d31866b03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,14 +243,14 @@ func (c *AppConfig) load(configPath string) {
for _, key := range viper.AllKeys() { for _, key := range viper.AllKeys() {
envKey := strings.ToUpper(strings.ReplaceAll(key, ".", "_")) envKey := strings.ToUpper(strings.ReplaceAll(key, ".", "_"))
err := viper.BindEnv(key, "AUTOBRR_"+envKey) err := viper.BindEnv(key, "AUTOBRR__"+envKey)
if err != nil { if err != nil {
log.Fatal("config: unable to bind env: " + err.Error()) log.Fatal("config: unable to bind env: " + err.Error())
} }
} }
if err := viper.Unmarshal(c.Config); err != nil { if err := viper.Unmarshal(c.Config); err != nil {
log.Fatalf("Could not unmarshal config file: %v", viper.ConfigFileUsed()) log.Fatalf("Could not unmarshal config file: %v: err %q", viper.ConfigFileUsed(), err)
} }
} }