mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-17 07:50:33 +08:00
fix(config): improve runtime config fallback handling
This commit is contained in:
parent
86c3b241b1
commit
57d4149807
@ -174,11 +174,14 @@ impl Config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let runtime = Self::runtime().await;
|
let runtime = Self::runtime().await;
|
||||||
let runtime_arc = runtime.latest_arc();
|
let runtime_lastest = runtime.latest_arc();
|
||||||
let config = runtime_arc
|
// Fall back to committed config if runtime config is missing
|
||||||
|
let runtime_data = runtime.data_arc();
|
||||||
|
let config = runtime_lastest
|
||||||
.config
|
.config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("failed to get runtime config"))?;
|
.or_else(|| runtime_data.config.as_ref())
|
||||||
|
.ok_or_else(|| anyhow!("failed to generate runtime config, might need to restart application"))?;
|
||||||
|
|
||||||
help::save_yaml(&path, config, Some("# Generated by Clash Verge")).await?;
|
help::save_yaml(&path, config, Some("# Generated by Clash Verge")).await?;
|
||||||
Ok(path)
|
Ok(path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user