Skip to content

Commit

Permalink
Clean up embed_conductor_config
Browse files Browse the repository at this point in the history
  • Loading branch information
c12i committed Oct 29, 2024
1 parent 6f84ccb commit 95e2067
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions bindings/trycp_runner/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,27 @@ macro_rules! embed_conductor_config {
include_str!("../../../conductor-config/conductor-config.yaml");
static BASE_CONDUCTOR_CONFIG_CI: &str =
include_str!("../../../conductor-config/conductor-config-ci.yaml");

static CHC_CONDUCTOR_CONFIG: &str =
include_str!("../../../conductor-config/with_chc.yaml");

match std::env::var("CONDUCTOR_CONFIG") {
Ok(value) if value == "CI" => {
if std::env::var("CHC_ENABLED")
.map(|v| v == "1")
.unwrap_or(false)
{
return format!("{}\n{}", BASE_CONDUCTOR_CONFIG_CI, CHC_CONDUCTOR_CONFIG);
}
BASE_CONDUCTOR_CONFIG_CI.into()
}
_ => {
if std::env::var("CHC_ENABLED")
.map(|v| v == "1")
.unwrap_or(false)
{
return format!("{}\n{}", BASE_CONDUCTOR_CONFIG, CHC_CONDUCTOR_CONFIG);
}
BASE_CONDUCTOR_CONFIG.into()
}
let mut config = if std::env::var("CONDUCTOR_CONFIG")
.map(|value| value == "CI")
.unwrap_or(false)
{
BASE_CONDUCTOR_CONFIG_CI
} else {
BASE_CONDUCTOR_CONFIG
};

if std::env::var("CHC_ENABLED")
.map(|v| v == "1")
.unwrap_or(false)
{
config = format!("{}\n{}", config, CHC_CONDUCTOR_CONFIG);
}

config
}
};
}

0 comments on commit 95e2067

Please sign in to comment.