From 71b38c4d0b9faff13023af22150f65d9816b39e2 Mon Sep 17 00:00:00 2001 From: Mihail Slobodyanuk Date: Fri, 23 Dec 2022 12:52:54 +0200 Subject: [PATCH] Minor refactoring --- cmd/mesh/main.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/mesh/main.go b/cmd/mesh/main.go index 2d981fb1..447a2095 100644 --- a/cmd/mesh/main.go +++ b/cmd/mesh/main.go @@ -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,