diff --git a/config.go b/config.go index 941342f..a7ac8ed 100644 --- a/config.go +++ b/config.go @@ -10,6 +10,7 @@ import ( "time" log "github.com/sirupsen/logrus" + "github.com/tailscale/hujson" ) type Config struct { @@ -58,8 +59,13 @@ func (c *Config) LoadFile(path string) error { return err } - err = json.Unmarshal(b, &c) + b, err = hujson.Standardize(b) if err != nil { + log.WithFields(log.Fields{"path": path, "error": err, "call": "hujson.Standardize"}).Errorf("") + return err + } + + if err := json.Unmarshal(b, &c); err != nil { log.WithFields(log.Fields{"path": path, "error": err, "call": "json.Unmarshal"}).Errorf("") return err } diff --git a/go.mod b/go.mod index ecc3fab..62b8a62 100644 --- a/go.mod +++ b/go.mod @@ -6,5 +6,6 @@ require ( github.com/gin-gonic/gin v1.9.1 // indirect github.com/silenceper/pool v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a // indirect golang.org/x/crypto v0.9.0 ) diff --git a/go.sum b/go.sum index 04f3e81..5e17c11 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,7 @@ github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -61,6 +62,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a h1:SJy1Pu0eH1C29XwJucQo73FrleVK6t4kYz4NVhp34Yw= +github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a/go.mod h1:DFSS3NAGHthKo1gTlmEcSBiZrRJXi28rLNd/1udP1c8= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= diff --git a/version.go b/version.go index eec24af..9d278f7 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "89ae6ea" +var githash = "aa8d203" var branch = "v2" -var buildstamp = "2023-06-29_22:06:42" -var commits = "61" -var version = "89ae6ea-b61 - 2023-06-29_22:06:42" +var buildstamp = "2023-06-30_20:03:47" +var commits = "62" +var version = "aa8d203-b62 - 2023-06-30_20:03:47"