Build IP address and port of REST API from default values.

This commit is contained in:
Harald Kube 2021-02-25 23:00:32 +01:00
parent 66d7958392
commit 38024dfc5d

View file

@ -11,6 +11,8 @@ use async_std::task;
const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION"); const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION");
const DEFAULT_CONFIG_FILE_NAME: &str = "/etc/s0_logger.cfg"; 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() { fn main() {
let cli_args = clap_app!(s0_meter => let cli_args = clap_app!(s0_meter =>
@ -42,8 +44,11 @@ fn main() {
println!("Will NOT access GPIO pins"); 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 { 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_channels: fake_get_channels,
get_pulses_by_channel: fake_get_pulses_by_channel, get_pulses_by_channel: fake_get_pulses_by_channel,
}; };