mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 17:59:11 +00:00
refactor: replace ConfigSource with bool parameter (#1516)
This commit is contained in:
@@ -281,35 +281,19 @@ impl Drop for EasyTierLauncher {
|
||||
|
||||
pub type NetworkInstanceRunningInfo = crate::proto::api::manage::NetworkInstanceRunningInfo;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ConfigSource {
|
||||
Cli,
|
||||
File,
|
||||
Web,
|
||||
GUI,
|
||||
FFI,
|
||||
}
|
||||
|
||||
pub struct NetworkInstance {
|
||||
config: TomlConfigLoader,
|
||||
launcher: Option<EasyTierLauncher>,
|
||||
|
||||
config_source: ConfigSource,
|
||||
}
|
||||
|
||||
impl NetworkInstance {
|
||||
pub fn new(config: TomlConfigLoader, source: ConfigSource) -> Self {
|
||||
pub fn new(config: TomlConfigLoader) -> Self {
|
||||
Self {
|
||||
config,
|
||||
launcher: None,
|
||||
config_source: source,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_config_source(&self) -> ConfigSource {
|
||||
self.config_source.clone()
|
||||
}
|
||||
|
||||
pub fn is_easytier_running(&self) -> bool {
|
||||
self.launcher.is_some() && self.launcher.as_ref().unwrap().running()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user