diff --git a/src/lib/lib.rs b/src/lib/lib.rs index bb6d501..92ad285 100644 --- a/src/lib/lib.rs +++ b/src/lib/lib.rs @@ -202,6 +202,19 @@ pub fn remove_disk_request( } } +// default filename for daemon_output +fn default_out() -> String { + "bynar_daemon.out".to_string() +} +// default filename for daemon_err +fn default_err() -> String { + "bynar_daemon.err".to_string() +} +//default filename for daemon_pid +fn default_pid() -> String { + "bynar_daemon.pid".to_string() +} + #[derive(Clone, Debug, Deserialize)] pub struct ConfigSettings { pub manager_host: String, @@ -227,13 +240,13 @@ pub struct ConfigSettings { pub jira_project_id: String, pub jira_ticket_assignee: String, /// Name of the Daemon Output file - #[serde(default = "bynar_daemon.out")] + #[serde(default = "default_out")] pub daemon_output: String, /// Name of the Daemon Error file - #[serde(default = "bynar_daemon.err")] + #[serde(default = "default_err")] pub daemon_error: String, /// Name of the Daemon pid file - #[serde(default = "bynar_daemon.pid")] + #[serde(default = "default_pid")] pub daemon_pid: String, pub proxy: Option, pub database: DBConfig, diff --git a/src/main.rs b/src/main.rs index 67de00c..eea4d67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -573,10 +573,8 @@ fn main() { let outfile = format!("/var/log/{}", config.daemon_output); let errfile = format!("/var/log/{}", config.daemon_error); let pidfile = format!("/var/log/{}", config.daemon_pid); - let stdout = File::create(&outfile) - .expect(&format!("{} creation failed", outfile)); - let stderr = File::create(&errfile) - .expect(&format!("{} creation failed", errfile)); + let stdout = File::create(&outfile).expect(&format!("{} creation failed", outfile)); + let stderr = File::create(&errfile).expect(&format!("{} creation failed", errfile)); trace!("I'm Parent and My pid is {}", process::id()); @@ -601,7 +599,6 @@ fn main() { } info!("Starting up"); - let simulate = matches.is_present("simulate"); let time = matches.value_of("time").unwrap().parse::().unwrap(); let h_info = Host::new(); @@ -612,7 +609,6 @@ fn main() { } let host_info = h_info.expect("Failed to gather host information"); debug!("Gathered host info: {:?}", host_info); - let db_pool = match create_db_connection_pool(&config.database) { Err(e) => {