Fix: respect pre-existing env vars over .mappsrc config file#156
Open
codyfrisch wants to merge 1 commit intomondaycom:masterfrom
Open
Fix: respect pre-existing env vars over .mappsrc config file#156codyfrisch wants to merge 1 commit intomondaycom:masterfrom
codyfrisch wants to merge 1 commit intomondaycom:masterfrom
Conversation
setConfigDataInProcessEnv now skips env vars that are already set, unless force=true (used by mapps init when the user explicitly provides a new token). Closes mondaycom#155 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.mappsrcconfig file unconditionally overwriting pre-existing environment variablesforceparameter tosetConfigDataInProcessEnv— defaults tofalseso the init hook respects env vars already set by the usermapps initpassesforce: trueso explicitly entered tokens always take effectCloses #155
Motivation
When working on the same project with multiple accounts (e.g. dev vs test/prod), there's no way to temporarily override the stored token via
MONDAY_CODE_ACCESS_TOKENwithout re-runningmapps init. The--localflag solves per-project config but not per-account switching.Standard CLI convention is: env var > config file > default. This change aligns
mappswith that expectation.Changes
src/services/config-service.ts:setConfigDataInProcessEnvnow checks if the env var is already set before writing (unlessforce: true)src/services/__tests__/config-service.test.ts: New test suite covering the precedence behavior and theinitforce-set edge caseTest plan
mapps initforce-sets even with pre-existing env varMONDAY_CODE_ACCESS_TOKENbefore running an authenticated command with a.mappsrcpresent — env var takes precedence as expected🤖 Generated with Claude Code