Compare commits
2 Commits
4fb3533074
...
1578216712
| Author | SHA1 | Date |
|---|---|---|
|
|
1578216712 | |
|
|
5a1588e256 |
|
|
@ -51,7 +51,10 @@ fn load_processes(json_filename: &str) -> Option<Processes> {
|
|||
pub async fn get_actual_config(params : Arc<PrebootParams>) -> Option<Processes> {
|
||||
// * if no local conf -> loop and +inf getting conf from redis server
|
||||
// * if local conf -> once getting conf from redis server
|
||||
let config_path = params.config.to_str()?;
|
||||
let config_path = params.config.to_str().unwrap_or_else(|| {
|
||||
error!("Invalid character in config file. Config path was set to default");
|
||||
"settings.json"
|
||||
});
|
||||
info!("Configurating config module with params: no-remote-config={}, no-sub={}, local config path={:?}, remote server={}", params.no_remote_config, params.no_sub, params.config, params.remote_server_url);
|
||||
match load_processes(config_path) {
|
||||
Some(local_conf) => {
|
||||
|
|
|
|||
|
|
@ -102,19 +102,26 @@ pub struct PrebootParams {
|
|||
}
|
||||
|
||||
impl PrebootParams {
|
||||
pub fn validate(self) -> Result<Self> {
|
||||
pub fn validate(mut self) -> Result<Self> {
|
||||
if !self.socket_path.exists() && !self.no_hostagent {
|
||||
return Err(Error::msg("Socket-file not found or Noxis can't read it. Cannot start"));
|
||||
eprintln!("Error: Socket-file not found or Noxis can't read it. Socket-file was set to default");
|
||||
self.socket_path = PathBuf::from("/var/run/enode/hostagent.sock");
|
||||
// return Err(Error::msg("Socket-file not found or Noxis can't read it. Cannot start"));
|
||||
}
|
||||
// existing log dir
|
||||
if !self.log_to.exists() && !self.no_logs {
|
||||
return Err(Error::msg("Log Directory Not Found or Noxis can't read it. Cannot start"));
|
||||
eprintln!("Error: LogDir not found or Noxis can't read it. LogDir was set to default");
|
||||
self.log_to = PathBuf::from("./");
|
||||
// return Err(Error::msg("Log Directory Not Found or Noxis can't read it. Cannot start"));
|
||||
}
|
||||
// existing sock file
|
||||
if !self.config.exists() {
|
||||
return Err(Error::msg("Local Config Not Found or Noxis can't read it. Cannot start"));
|
||||
eprintln!("Error: Invalid character in config file. Config path was set to default");
|
||||
self.config = PathBuf::from("settings.json");
|
||||
// return Err(Error::msg("Local Config Not Found or Noxis can't read it. Cannot start"));
|
||||
}
|
||||
// redis server check
|
||||
dbg!(&self);
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue