5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-24 17:15:40 +00:00

Remove hyphens when auto-loading envvars from viper config (#545)

* When auto-loading envvars from toml keys, remove hyphens.

See: https://unix.stackexchange.com/questions/23659/can-shell-variable-include-character
This commit is contained in:
Patrick Connolly 2018-11-03 21:42:27 +08:00 committed by Wim
parent d058be25ad
commit 7e62bc4819

View File

@ -186,7 +186,7 @@ func NewConfig(cfgfile string) *Config {
viper.SetConfigFile(cfgfile)
viper.SetEnvPrefix("matterbridge")
viper.AddConfigPath(".")
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
viper.AutomaticEnv()
f, err := os.Open(cfgfile)
if err != nil {