From 95e2067472712c388af20241d3ad8115ff7cb121 Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Tue, 29 Oct 2024 11:34:27 +0300 Subject: [PATCH] Clean up embed_conductor_config --- bindings/trycp_runner/src/macros.rs | 37 +++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/bindings/trycp_runner/src/macros.rs b/bindings/trycp_runner/src/macros.rs index 803f5558..5f475a95 100644 --- a/bindings/trycp_runner/src/macros.rs +++ b/bindings/trycp_runner/src/macros.rs @@ -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 } }; } +