diff --git a/src/args/mod.rs b/src/args/mod.rs index afcf0ee..e55dbbb 100644 --- a/src/args/mod.rs +++ b/src/args/mod.rs @@ -1,9 +1,9 @@ use clap::{App, Arg}; -use crate::VERSION; use crate::DEFAULT_HOST; use crate::DEFAULT_PORT_STR; use crate::DEFAULT_WORKERS_STR; +use crate::VERSION; pub mod parse; @@ -24,21 +24,18 @@ pub fn get_app() -> App<'static, 'static> { .short("h") .long("host") .value_name("HOST") - .default_value(&DEFAULT_HOST) .help("The address the server listens on.") .takes_value(true), Arg::with_name("port") .short("p") .long("port") .value_name("PORT") - .default_value(&DEFAULT_PORT_STR) .help("The port to run the server on.") .takes_value(true), Arg::with_name("workers") .short("w") .long("workers") .value_name("NUMBER") - .default_value(&DEFAULT_WORKERS_STR) .help("The number of workers to serve requests with (Defaults to the number of cores on the system).") .takes_value(true), ]) diff --git a/src/args/parse.rs b/src/args/parse.rs index 27b87ca..59d1bc5 100644 --- a/src/args/parse.rs +++ b/src/args/parse.rs @@ -5,6 +5,7 @@ use clap::ArgMatches; use crate::config::model::Config; fn get_config_for_string(arg_value: Option<&str>, config_value: &Option, default_value: &str) -> String { + debug!("arg: {:?}; config: {:?}; default: {}", arg_value, config_value, default_value); String::from(match arg_value { Some(v) => v, None => match config_value { @@ -14,7 +15,8 @@ fn get_config_for_string(arg_value: Option<&str>, config_value: &Option, }) } -fn get_config_for_number(arg_value: Option<&str>, config_value: Option, default_value: T) -> T { +fn get_config_for_number(arg_value: Option<&str>, config_value: Option, default_value: T) -> T { + debug!("arg: {:?}; config: {:?}; default: {:?}", arg_value, config_value, default_value); match arg_value { Some(v) => v.parse::().unwrap_or(default_value), None => match config_value {