Skip to content

Commit

Permalink
Explicitly disable plugin when MIRRORD_ACTIVE=0 (#298)
Browse files Browse the repository at this point in the history
* explicitly disable plugin when `MIRRORD_ACTIVE=0`

* add changelog
  • Loading branch information
noamcohen97 authored Nov 20, 2024
1 parent 49ec3ba commit b09b78d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/+explicitly-disable-from-env.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Setting `MIRRORD_ACTIVE=0` environment variable will explicitly disable mirrord.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ class MirrordExecManager(private val service: MirrordProjectService) {
projectEnvVars: Map<String, String>?
): MirrordExecution? {
MirrordLogger.logger.debug("MirrordExecManager.start")
val explicitlyEnabled = projectEnvVars?.any { (key, value) -> key == "MIRRORD_ACTIVE" && value == "1" } ?: false
if (!service.enabled && !explicitlyEnabled) {
val mirrordActiveValue = projectEnvVars?.get("MIRRORD_ACTIVE")
val explicitlyEnabled = mirrordActiveValue == "1"
val explicitlyDisabled = mirrordActiveValue == "0"
if ((!service.enabled && !explicitlyEnabled) || explicitlyDisabled) {
MirrordLogger.logger.debug("disabled, returning")
return null
}
Expand Down

0 comments on commit b09b78d

Please sign in to comment.