Skip to content

Commit

Permalink
apply yaml merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Nov 2, 2024
1 parent 98d183b commit 4528839
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion clash_lib/src/config/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,21 @@ impl FromStr for Config {
type Err = Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_yaml::from_str(s).map_err(|x| {
let mut val: Value = serde_yaml::from_str(s).map_err(|x| {
Error::InvalidConfig(format!(
"cound not parse config content {}: {}",
s, x
))
})?;

val.apply_merge().map_err(|x| {
Error::InvalidConfig(format!(
"failed to process anchors in config content {}: {}",
s, x
))
})?;

serde_yaml::from_value(val).map_err(|x| {
Error::InvalidConfig(format!(
"cound not parse config content {}: {}",
s, x
Expand Down

0 comments on commit 4528839

Please sign in to comment.