diff --git a/src/global.rs b/src/global.rs index 32e768c..717e3c2 100644 --- a/src/global.rs +++ b/src/global.rs @@ -19,6 +19,11 @@ pub static USED_RESOURCES: LazyLock = LazyLock::new(|| { .unwrap_or(format!("{home}/.detee/app_daemon/used_resources.yaml")) }); +pub static DAEMON_CONFIG_DIR: LazyLock = LazyLock::new(|| { + let home = home::home_dir().unwrap().to_string_lossy().into_owned(); + std::env::var(DETEE_DIR_ENV_NAME).unwrap_or(format!("{home}/.detee/app_daemon/config.yaml")) +}); + pub static APP_CONFIG_DIR: LazyLock = LazyLock::new(|| { let home = home::home_dir().unwrap().to_string_lossy().into_owned(); std::env::var(DETEE_DIR_ENV_NAME).unwrap_or(format!("{home}/.detee/app_daemon/deployed_apps/")) diff --git a/src/main.rs b/src/main.rs index c07118f..9c483cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,7 @@ pub use crate::config::HostConfig; pub use crate::data::HostResources; use global::APP_CONFIG_DIR; +use global::DAEMON_CONFIG_DIR; #[derive(Debug)] pub struct AppHandler { @@ -41,7 +42,7 @@ impl AppHandler { // TODO: load from config and resources from file, // if not found use default and save host resources to file - let host_config = match HostConfig::load_from_disk(&APP_CONFIG_DIR) { + let host_config = match HostConfig::load_from_disk(&DAEMON_CONFIG_DIR) { Ok(config) => config, Err(e) => panic!("Could not load config: {e:?}"), };