From 7e62bc4819f23c57726225916f97c45ed04c60f9 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Sat, 3 Nov 2018 21:42:27 +0800 Subject: 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 --- bridge/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index eff93094..0e36d960 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -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 { -- cgit v1.2.3