diff --git a/.metadata.sh b/.metadata.sh index 72f614d5..dd683d8c 100755 --- a/.metadata.sh +++ b/.metadata.sh @@ -11,7 +11,7 @@ HBREPO="golift/homebrew-mugs" MAINT="David Newhall II " VENDOR="Go Lift " DESC="Polls a UniFi controller and exports metrics to InfluxDB" -GOLANGCI_LINT_ARGS="--enable-all -D gochecknoglobals -e dupl -e G101" +GOLANGCI_LINT_ARGS="--enable-all -D gochecknoglobals -D dupl -D lll -e G101 " # Example must exist at examples/$CONFIG_FILE.example CONFIG_FILE="up.conf" LICENSE="MIT" diff --git a/unifipoller/config.go b/unifipoller/config.go index ad64a050..008caf7b 100644 --- a/unifipoller/config.go +++ b/unifipoller/config.go @@ -62,8 +62,8 @@ type Config struct { ReAuth bool `json:"reauthenticate" toml:"reauthenticate" xml:"reauthenticate" yaml:"reauthenticate" env:"UP_REAUTHENTICATE"` Mode string `json:"mode" toml:"mode" xml:"mode" yaml:"mode" env:"UP_POLLING_MODE"` InfluxURL string `json:"influx_url,_omitempty" toml:"influx_url,_omitempty" xml:"influx_url" yaml:"influx_url" env:"UP_INFLUX_URL"` - InfluxUser string `json:"influx_user,_omitempty" toml:"influx_user,_omitempty" xml:"influx_user" yaml:"influx_user" env:"UP_INFLUX_USER"` - InfluxPass string `json:"influx_pass,_omitempty" toml:"influx_pass,_omitempty" xml:"influx_pass" yaml:"influx_pass" env:"UP_INFLUX_PASS"` + InfluxUser string `json:"influx_user,_omitempty" toml:"influx_user,_omitempty" xml:"influx_user" yaml:"influx_user" env:"INFLUX_USER"` + InfluxPass string `json:"influx_pass,_omitempty" toml:"influx_pass,_omitempty" xml:"influx_pass" yaml:"influx_pass" env:"INFLUX_PASS"` InfluxDB string `json:"influx_db,_omitempty" toml:"influx_db,_omitempty" xml:"influx_db" yaml:"influx_db" env:"UP_INFLUX_DB"` UnifiUser string `json:"unifi_user,_omitempty" toml:"unifi_user,_omitempty" xml:"unifi_user" yaml:"unifi_user" env:"UP_UNIFI_USER"` UnifiPass string `json:"unifi_pass,_omitempty" toml:"unifi_pass,_omitempty" xml:"unifi_pass" yaml:"unifi_pass" env:"UP_UNIFI_PASS"` diff --git a/unifipoller/helpers.go b/unifipoller/helpers.go index 5cb2041d..c2e0fce4 100644 --- a/unifipoller/helpers.go +++ b/unifipoller/helpers.go @@ -43,26 +43,3 @@ func (u *UnifiPoller) LogDebugf(m string, v ...interface{}) { func (u *UnifiPoller) LogErrorf(m string, v ...interface{}) { _ = log.Output(2, fmt.Sprintf("[ERROR] "+m, v...)) } - -// pick returns the first non empty string in a list. -// used in a few places around this library. -func pick(strings ...string) string { - for _, s := range strings { - if s != "" { - return s - } - } - return "" -} - -// parseBool returns true/false if the string is "true" or "false", otherwise returns e value. -func parseBool(s string, e bool) bool { - switch s { - case "true", "t": - return true - case "false", "f": - return false - default: - return e - } -}