default impl self-written + config preboot param check fixed
parent
5d54c5b97c
commit
eed9fa881a
|
|
@ -38,16 +38,34 @@ impl std::fmt::Display for EnvVars {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for EnvVars {
|
// impl<'a> Default for EnvVars {
|
||||||
fn default() {
|
// fn default() -> &'a str {
|
||||||
todo!()
|
// todo!()
|
||||||
// setting default env vars values if not exists
|
// // setting default env vars values if not exists
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
impl<'a> EnvVars {
|
||||||
|
// Default trait func is not satisfying this issue
|
||||||
|
fn default(self) -> &'a str {
|
||||||
|
match self {
|
||||||
|
EnvVars::NoxisNoHagent => "false",
|
||||||
|
EnvVars::NoxisNoLogs => "false",
|
||||||
|
EnvVars::NoxisRefreshLogs => "false",
|
||||||
|
EnvVars::NoxisNoRemoteConfig => "false",
|
||||||
|
EnvVars::NoxisNoConfigSub => "false",
|
||||||
|
EnvVars::NoxisSocketPath => "/var/run/enode/hostagent.sock",
|
||||||
|
EnvVars::NoxisLogTo => "./",
|
||||||
|
EnvVars::NoxisRemoteServerUrl => "localhost",
|
||||||
|
EnvVars::NoxisConfig => "./settings.json",
|
||||||
|
EnvVars::NoxisMetrics => "NOXIS_METRICS",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl EnvVars {
|
|
||||||
fn setup() {
|
fn setup() {
|
||||||
|
// setup default if not exists
|
||||||
|
|
||||||
|
// check values and save preboot states in env vars if not equal
|
||||||
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,6 +274,10 @@ impl PrebootParams {
|
||||||
// existing sock file
|
// existing sock file
|
||||||
if !self.config.exists() {
|
if !self.config.exists() {
|
||||||
eprintln!("Error: Invalid character in config file. Config path was set to default");
|
eprintln!("Error: Invalid character in config file. Config path was set to default");
|
||||||
|
let config = PathBuf::from("/etc/settings.json");
|
||||||
|
if !config.exists() && self.no_remote_config {
|
||||||
|
return Err(Error::msg("Noxis cannot run without config. Create local config or enable remote-config mechanism"));
|
||||||
|
}
|
||||||
self.config = PathBuf::from("settings.json");
|
self.config = PathBuf::from("settings.json");
|
||||||
// return Err(Error::msg("Local Config Not Found or Noxis can't read it. Cannot start"));
|
// return Err(Error::msg("Local Config Not Found or Noxis can't read it. Cannot start"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue