Skip to content

feat(configstore): support local .leash.toml override file#70

Merged
jaytaylor merged 1 commit into
strongdm:mainfrom
karimfan:feat/local-config-overlay
Apr 6, 2026
Merged

feat(configstore): support local .leash.toml override file#70
jaytaylor merged 1 commit into
strongdm:mainfrom
karimfan:feat/local-config-overlay

Conversation

@karimfan
Copy link
Copy Markdown
Contributor

@karimfan karimfan commented Apr 5, 2026

Summary

  • Adds support for a project-local .leash.toml override file that gets merged on top of the global XDG config (~/.config/leash/config.toml)
  • Teams can commit shared config to a repo while individual engineers keep secrets in a gitignored .leash.toml
  • Local values take precedence: scalars override, maps are deep-merged

Closes #55

Changes

  • internal/configstore/config.goMerge(base, overlay Config) deep-merges two configs
  • internal/configstore/path.goLocalConfigFileName constant (.leash.toml) and GetLocalConfigPath() helper
  • internal/configstore/loadsave.goLoadWithOverlay(dir) loads global config then merges local .leash.toml on top
  • internal/runner/runner.go and mount_state.go — Updated to use LoadWithOverlay(callerDir) instead of Load()

Design decisions

  • Read-only local file: Save() still writes only to the global XDG config. The local .leash.toml is user-managed, avoiding accidental secret persistence in the wrong location.
  • Convention over configuration: No new CLI flags needed — .leash.toml is auto-discovered in the working directory.
  • Implements the "local override file" approach from the issue discussion.

Test plan

  • TestMerge* — 7 tests covering empty overlay, scalar override, map merging, project-level merging, base immutability
  • TestLoadWithOverlay* — 5 tests covering no local file, merge behavior, target image override, empty dir, bad TOML error
  • TestGetLocalConfigPath — path helper
  • All existing configstore tests pass

🤖 Generated with Claude Code

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>
@karimfan
Copy link
Copy Markdown
Contributor Author

karimfan commented Apr 5, 2026

@navanchauhan This implements the local override file approach you suggested in #55. Would appreciate your review!

@jaytaylor
Copy link
Copy Markdown
Collaborator

Thank you for your contribution, @karimfan !

@jaytaylor jaytaylor merged commit fd8e0c1 into strongdm:main Apr 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: load+cascade configuration from multiple files

2 participants