Custom API port (#62)

Adds ability to specify API Port, either via CLI or in config. If port is not provided, default is used, taking into account if TLS is enabled or not
This commit is contained in:
Welby McRoberts
2019-12-26 18:17:27 +00:00
committed by Steve Brunton
parent 9ceb56fdbf
commit 55ae663ce3
4 changed files with 14 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ var (
logLevel = flag.String("log-level", "info", "log level")
metricsPath = flag.String("path", "/metrics", "path to answer requests on")
password = flag.String("password", "", "password for authentication for single device")
deviceport = flag.String("deviceport", "8728", "port for single device")
port = flag.String("port", ":9436", "port number to listen on")
timeout = flag.Duration("timeout", collector.DefaultTimeout, "timeout when connecting to devices")
tls = flag.Bool("tls", false, "use tls to connect to routers")
@@ -121,6 +122,7 @@ func loadConfigFromFlags() (*config.Config, error) {
Address: *address,
User: *user,
Password: *password,
Port: *deviceport,
},
},
}, nil