diff options
Diffstat (limited to 'lib/instance.go')
| -rw-r--r-- | lib/instance.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/instance.go b/lib/instance.go index 79949c0f..0a16442e 100644 --- a/lib/instance.go +++ b/lib/instance.go @@ -5,6 +5,8 @@ import ( "errors" "os" "strings" + + "github.com/tailscale/hujson" ) type Instance struct { @@ -34,6 +36,9 @@ func (i *Instance) Init(configFile string) error { return err } + // Support JSON with comments and trailing commas + content, _ = hujson.Standardize(content) + if err := json.Unmarshal(content, &i.config); err != nil { return err } @@ -50,6 +55,9 @@ func (i *Instance) Init(configFile string) error { } func (i *Instance) InitFromBytes(content []byte) error { + // Support JSON with comments and trailing commas + content, _ = hujson.Standardize(content) + if err := json.Unmarshal(content, &i.config); err != nil { return err } |
