Minor refactoring

This commit is contained in:
Mihail Slobodyanuk 2022-12-23 12:52:54 +02:00
parent 97a84cd1f1
commit 71b38c4d0b

View file

@ -201,7 +201,7 @@ func run(args yggArgs, ctx context.Context) {
// that neither -autoconf, -useconf or -useconffile were set above. Stop
// if we don't.
if cfg == nil {
return
panic("broken configuration")
}
n := &node{}
// Have we been asked for the node address yet? If so, print it and then stop.
@ -230,13 +230,6 @@ func run(args yggArgs, ctx context.Context) {
}
return
}
//override httpaddress and wwwroot parameters in cfg
if len(cfg.HttpAddress) == 0 {
cfg.HttpAddress = args.httpaddress
}
if len(cfg.WwwRoot) == 0 {
cfg.WwwRoot = args.wwwroot
}
// Setup the RiV-mesh node itself.
{
@ -274,6 +267,14 @@ func run(args yggArgs, ctx context.Context) {
// Setup the REST socket.
{
//override httpaddress and wwwroot parameters in cfg
if len(cfg.HttpAddress) == 0 {
cfg.HttpAddress = args.httpaddress
}
if len(cfg.WwwRoot) == 0 {
cfg.WwwRoot = args.wwwroot
}
if n.rest_server, err = restapi.NewRestServer(restapi.RestServerCfg{
Core: n.core,
Log: logger,