From d0b462523bf146b90b43d4ef9c9630ebd3c1b3c6 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Fri, 21 Jun 2019 04:29:07 -0700 Subject: [PATCH] fixes --- examples/up.json.example | 2 +- examples/up.xml.example | 56 +++++++++++++++++++++++++++++++++----- pkg/unifi-poller/poller.go | 4 +-- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/examples/up.json.example b/examples/up.json.example index bc3f408b..2d2c415f 100644 --- a/examples/up.json.example +++ b/examples/up.json.example @@ -9,7 +9,7 @@ "influx_pass": "unifi", "influx_db": "unifi", "unifi_user": "influxdb", - "unifi_pass": "4BB9345C-2341-48D7-99F5-E01B583FF77F", + "unifi_pass": "", "unifi_url": "https://127.0.0.1:8443", "verify_ssl": false } diff --git a/examples/up.xml.example b/examples/up.xml.example index dfb6a07f..c7d28a72 100644 --- a/examples/up.xml.example +++ b/examples/up.xml.example @@ -1,15 +1,57 @@ + + + +default + + +30s + + false + + +false + + +0 + + unifi unifi http://127.0.0.1:8086 unifi -30s -0 -false -default -site2 -4BB9345C-2341-48D7-99F5-E01B583FF77F -https://127.0.0.1:8443 + + + influxdb + +https://127.0.0.1:8443 + false diff --git a/pkg/unifi-poller/poller.go b/pkg/unifi-poller/poller.go index ba75d2ec..203bd684 100644 --- a/pkg/unifi-poller/poller.go +++ b/pkg/unifi-poller/poller.go @@ -49,14 +49,14 @@ func (u *UnifiPoller) GetConfig() (err error) { switch buf, err = ioutil.ReadFile(u.ConfigFile); { case err != nil: return err - default: - err = toml.Unmarshal(buf, u.Config) case strings.HasSuffix(u.ConfigFile, ".json"): err = json.Unmarshal(buf, u.Config) case strings.HasSuffix(u.ConfigFile, ".xml"): err = xml.Unmarshal(buf, u.Config) case strings.HasSuffix(u.ConfigFile, ".yaml"): err = yaml.Unmarshal(buf, u.Config) + default: + err = toml.Unmarshal(buf, u.Config) } if err != nil { return err