From 49ca28733e2a61e3321981b61131481d0a22d368 Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Wed, 10 Jan 2024 09:19:07 +0200 Subject: [PATCH] Users can now specify MIRRORD_ACTIVE=1 in run configuration's environment variable to explicitly enable mirrord regardless of the button status (#232) --- changelog.d/231.added.md | 1 + .../main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog.d/231.added.md diff --git a/changelog.d/231.added.md b/changelog.d/231.added.md new file mode 100644 index 00000000..78165021 --- /dev/null +++ b/changelog.d/231.added.md @@ -0,0 +1 @@ +Users can now specify MIRRORD_ACTIVE=1 in run configuration's environment variable to explicitly enable mirrord regardless of the button status \ No newline at end of file diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt index 1a6a7eb5..b51ecbf0 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt @@ -100,7 +100,8 @@ class MirrordExecManager(private val service: MirrordProjectService) { projectEnvVars: Map? ): Pair, String?>? { MirrordLogger.logger.debug("MirrordExecManager.start") - if (!service.enabled) { + val explicitlyEnabled = projectEnvVars?.any { (key, value) -> key == "MIRRORD_ACTIVE" && value == "1" } ?: false + if (!service.enabled && !explicitlyEnabled) { MirrordLogger.logger.debug("disabled, returning") return null }