5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-10 06:20:26 +00:00

Merge pull request #492 from neilalexander/fixlisten

Transform Listen statement to new format if needed
This commit is contained in:
Neil Alexander 2019-08-07 10:57:55 +01:00 committed by GitHub
commit 71e9ca25f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,6 +74,12 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
if err := hjson.Unmarshal(conf, &dat); err != nil { if err := hjson.Unmarshal(conf, &dat); err != nil {
panic(err) panic(err)
} }
// Check for fields that have changed type recently, e.g. the Listen config
// option is now a []string rather than a string
if listen, ok := dat["Listen"].(string); ok {
dat["Listen"] = []string{listen}
}
// Sanitise the config
confJson, err := json.Marshal(dat) confJson, err := json.Marshal(dat)
if err != nil { if err != nil {
panic(err) panic(err)