feat(configstore): support local .leash.toml override file#70
Merged
Conversation
Allow users to place a .leash.toml file in their project directory to layer secrets and personal configuration on top of the global XDG config. This enables teams to commit shared config while keeping credentials gitignored locally. Closes strongdm#55 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@navanchauhan This implements the local override file approach you suggested in #55. Would appreciate your review! |
Collaborator
|
Thank you for your contribution, @karimfan ! |
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
.leash.tomloverride file that gets merged on top of the global XDG config (~/.config/leash/config.toml).leash.tomlCloses #55
Changes
internal/configstore/config.go—Merge(base, overlay Config)deep-merges two configsinternal/configstore/path.go—LocalConfigFileNameconstant (.leash.toml) andGetLocalConfigPath()helperinternal/configstore/loadsave.go—LoadWithOverlay(dir)loads global config then merges local.leash.tomlon topinternal/runner/runner.goandmount_state.go— Updated to useLoadWithOverlay(callerDir)instead ofLoad()Design decisions
Save()still writes only to the global XDG config. The local.leash.tomlis user-managed, avoiding accidental secret persistence in the wrong location..leash.tomlis auto-discovered in the working directory.Test plan
TestMerge*— 7 tests covering empty overlay, scalar override, map merging, project-level merging, base immutabilityTestLoadWithOverlay*— 5 tests covering no local file, merge behavior, target image override, empty dir, bad TOML errorTestGetLocalConfigPath— path helper🤖 Generated with Claude Code