From 38024dfc5d6ec638ca5961909136980a10c0351d Mon Sep 17 00:00:00 2001 From: Harald Kube Date: Thu, 25 Feb 2021 23:00:32 +0100 Subject: [PATCH] Build IP address and port of REST API from default values. --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f6e38f7..26f01f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,8 @@ use async_std::task; const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION"); const DEFAULT_CONFIG_FILE_NAME: &str = "/etc/s0_logger.cfg"; +const DEFAULT_IP_ADDRESS: &str = "127.0.0.1"; +const DEFAULT_IP_PORT: &str = "6310"; fn main() { let cli_args = clap_app!(s0_meter => @@ -42,8 +44,11 @@ fn main() { println!("Will NOT access GPIO pins"); } + let rest_ip_addr = DEFAULT_IP_ADDRESS; + let rest_ip_port = DEFAULT_IP_PORT; + let rest_api_config = rest_api::RestApiConfig { - ip_and_port: String::from("127.0.0.1:8080"), + ip_and_port: format!("{}:{}", &rest_ip_addr, &rest_ip_port), get_channels: fake_get_channels, get_pulses_by_channel: fake_get_pulses_by_channel, };