diff --git a/main.go b/main.go index 4e12670..9fdacd2 100644 --- a/main.go +++ b/main.go @@ -103,6 +103,7 @@ func init() { func initConfig() { viper.SetEnvPrefix("INPUT") + viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_")) viper.AutomaticEnv() viper.RegisterAlias("nats_url", "nats") @@ -110,6 +111,12 @@ func initConfig() { viper.RegisterAlias("strip_prefix", "prefix") viper.RegisterAlias("notify_topic", "notify") viper.RegisterAlias("clean_all", "cleanup-all") + + _ = viper.BindEnv("nats", "INPUT_NATS", "INPUT_NATS_URL") + _ = viper.BindEnv("dir", "INPUT_DIR", "INPUT_SOURCE") + _ = viper.BindEnv("prefix", "INPUT_PREFIX", "INPUT_STRIP_PREFIX") + _ = viper.BindEnv("notify", "INPUT_NOTIFY", "INPUT_NOTIFY_TOPIC") + _ = viper.BindEnv("cleanup-all", "INPUT_CLEANUP_ALL", "INPUT_CLEAN_ALL") } type NATSClient struct {