From 48f5ba2cf817ae10cd867e22e0cf476f7bd91032 Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Mon, 2 Dec 2019 13:05:56 -0800 Subject: [PATCH] fix env variable usage --- pkg/poller/config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/poller/config.go b/pkg/poller/config.go index 2ded5926..fd914f9f 100644 --- a/pkg/poller/config.go +++ b/pkg/poller/config.go @@ -114,8 +114,9 @@ func (c *Config) ParseENV() error { t := reflect.TypeOf(Config{}) // Get tag names from the Config struct. // Loop each Config struct member; get reflect tag & env var value; update config. for i := 0; i < t.NumField(); i++ { - tag := strings.ToUpper(t.Field(i).Tag.Get("json")) // Get the ENV variable name from capitalized "json" struct tag - env := os.Getenv(ENVConfigPrefix + tag) // Then pull value from OS. + tag := t.Field(i).Tag.Get("json") // Get the ENV variable name from "json" struct tag + tag = strings.Split(strings.ToUpper(tag), ",")[0] // Capitalize and remove ,omitempty suffix + env := os.Getenv(ENVConfigPrefix + tag) // Then pull value from OS. if tag == "" || env == "" { continue // Skip if either are empty. }