mirror of
https://github.com/house-of-vanity/yggman.git
synced 2025-12-16 19:17:56 +00:00
Added agent
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::config::{AppConfig, ConfigManager};
|
||||
use crate::core::context::AppContext;
|
||||
use crate::core::module::ModuleManager;
|
||||
use crate::error::Result;
|
||||
use crate::settings_manager::SettingsManager;
|
||||
use tokio::signal;
|
||||
|
||||
pub struct Application {
|
||||
@@ -10,9 +11,18 @@ pub struct Application {
|
||||
}
|
||||
|
||||
impl Application {
|
||||
pub fn new(config: AppConfig) -> Self {
|
||||
pub fn new(config: AppConfig, settings_manager: SettingsManager) -> Self {
|
||||
let config_manager = Arc::new(ConfigManager::new(config));
|
||||
let context = Arc::new(AppContext::new(config_manager));
|
||||
let context = Arc::new(AppContext::new(config_manager, Arc::new(settings_manager)));
|
||||
let module_manager = ModuleManager::new(context);
|
||||
|
||||
Self {
|
||||
module_manager,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_managers(config_manager: ConfigManager, settings_manager: SettingsManager) -> Self {
|
||||
let context = Arc::new(AppContext::new(Arc::new(config_manager), Arc::new(settings_manager)));
|
||||
let module_manager = ModuleManager::new(context);
|
||||
|
||||
Self {
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
use std::sync::Arc;
|
||||
use crate::config::ConfigManager;
|
||||
use crate::settings_manager::SettingsManager;
|
||||
|
||||
pub struct AppContext {
|
||||
pub config_manager: Arc<ConfigManager>,
|
||||
pub settings_manager: Arc<SettingsManager>,
|
||||
}
|
||||
|
||||
impl AppContext {
|
||||
pub fn new(config_manager: Arc<ConfigManager>) -> Self {
|
||||
pub fn new(config_manager: Arc<ConfigManager>, settings_manager: Arc<SettingsManager>) -> Self {
|
||||
Self {
|
||||
config_manager,
|
||||
settings_manager,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user