nats-upload: fix INPUT_* env vars for aliases
This commit is contained in:
7
main.go
7
main.go
@@ -103,6 +103,7 @@ func init() {
|
|||||||
|
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
viper.SetEnvPrefix("INPUT")
|
viper.SetEnvPrefix("INPUT")
|
||||||
|
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
viper.RegisterAlias("nats_url", "nats")
|
viper.RegisterAlias("nats_url", "nats")
|
||||||
@@ -110,6 +111,12 @@ func initConfig() {
|
|||||||
viper.RegisterAlias("strip_prefix", "prefix")
|
viper.RegisterAlias("strip_prefix", "prefix")
|
||||||
viper.RegisterAlias("notify_topic", "notify")
|
viper.RegisterAlias("notify_topic", "notify")
|
||||||
viper.RegisterAlias("clean_all", "cleanup-all")
|
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 {
|
type NATSClient struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user