                 }
 
                 let host = config["servers", name, "host"]?.string ?? "0.0.0.0"
-                let port = config["servers", name, "port"]?.int ?? 8080
+                let port = config["servers", name, "port"]?.int ?? cliPort ?? 8080
 
                 servers[name] = (host, port, securityLayer)
             }

            return servers
        } else {
            log.debug("No 'servers.json' configuration found, using defaults.")
            return [
                "default": ("0.0.0.0", 8080, .none)
            ]
        }
    }

    }
}


/**
    To support old form quick port setting through config.
*/
let cliPort: Int? = {
    return CommandLine.arguments.value(for: "port")?.int
}()
