fix on daemon config
This commit is contained in:
		
							parent
							
								
									a1e5ad641b
								
							
						
					
					
						commit
						07d5995ecc
					
				| @ -19,6 +19,11 @@ pub static USED_RESOURCES: LazyLock<String> = LazyLock::new(|| { | |||||||
|         .unwrap_or(format!("{home}/.detee/app_daemon/used_resources.yaml")) |         .unwrap_or(format!("{home}/.detee/app_daemon/used_resources.yaml")) | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | pub static DAEMON_CONFIG_DIR: LazyLock<String> = 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<String> = LazyLock::new(|| { | pub static APP_CONFIG_DIR: LazyLock<String> = LazyLock::new(|| { | ||||||
|     let home = home::home_dir().unwrap().to_string_lossy().into_owned(); |     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/")) |     std::env::var(DETEE_DIR_ENV_NAME).unwrap_or(format!("{home}/.detee/app_daemon/deployed_apps/")) | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ pub use crate::config::HostConfig; | |||||||
| pub use crate::data::HostResources; | pub use crate::data::HostResources; | ||||||
| 
 | 
 | ||||||
| use global::APP_CONFIG_DIR; | use global::APP_CONFIG_DIR; | ||||||
|  | use global::DAEMON_CONFIG_DIR; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
| pub struct AppHandler { | pub struct AppHandler { | ||||||
| @ -41,7 +42,7 @@ impl AppHandler { | |||||||
|         // TODO: load from config and resources from file,
 |         // TODO: load from config and resources from file,
 | ||||||
|         //       if not found use default and save host resources to 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, |             Ok(config) => config, | ||||||
|             Err(e) => panic!("Could not load config: {e:?}"), |             Err(e) => panic!("Could not load config: {e:?}"), | ||||||
|         }; |         }; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user