mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-30 23:25:36 +03:00
Don't embed structs (apparently it changes the HJSON structure)
This commit is contained in:
parent
029be2d86b
commit
7352891564
6 changed files with 61 additions and 80 deletions
|
@ -73,23 +73,6 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
|
|||
return cfg
|
||||
}
|
||||
|
||||
// Generates a new configuration and returns it in HJSON format. This is used
|
||||
// with -genconf.
|
||||
func doGenconf(isjson bool) string {
|
||||
cfg := config.GenerateConfig()
|
||||
var bs []byte
|
||||
var err error
|
||||
if isjson {
|
||||
bs, err = cfg.MarshalJSON()
|
||||
} else {
|
||||
bs, err = cfg.MarshalHJSON()
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
// The main function is responsible for configuring and starting Yggdrasil.
|
||||
func main() {
|
||||
// Configure the command line parameters.
|
||||
|
@ -137,7 +120,19 @@ func main() {
|
|||
}
|
||||
case *genconf:
|
||||
// Generate a new configuration and print it to stdout.
|
||||
fmt.Println(doGenconf(*confjson))
|
||||
cfg := config.GenerateConfig()
|
||||
var bs []byte
|
||||
var err error
|
||||
if *confjson {
|
||||
bs, err = cfg.MarshalJSON()
|
||||
} else {
|
||||
bs, err = cfg.MarshalHJSON()
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(bs))
|
||||
return
|
||||
default:
|
||||
// No flags were provided, therefore print the list of flags to stdout.
|
||||
flag.PrintDefaults()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue