Skip to content

feat: add mapping mode for multi-key Vault secrets#9

Merged
BinSquare merged 1 commit intoBinSquare:mainfrom
mdemauroy:feat/secret-mapping-mode
Feb 17, 2026
Merged

feat: add mapping mode for multi-key Vault secrets#9
BinSquare merged 1 commit intoBinSquare:mainfrom
mdemauroy:feat/secret-mapping-mode

Conversation

@mdemauroy
Copy link
Contributor

@mdemauroy mdemauroy commented Feb 11, 2026

Summary

  • Add a mapping configuration option to map environment variables to specific keys within multi-key Vault secrets, as an alternative to the path_prefix convention
  • Implement MultiKeyProvider interface and ReadSecret on vaultProvider to support reading all key-value pairs from a single secret path
  • Add CollectMappedSecrets helper that batches reads by path to minimize API calls
  • Validate that mapping and path_prefix are mutually exclusive; block write/delete in mapping mode (read-only)

Example configuration

envs:
  dev:
    provider: vault
    mapping:
      MY_FIRST_TOKEN:
        path: shared/cdn
        key: MY_TOKEN
      MY_APIKEY:
        path: app/cms
        key: MY_API_KEY

Test plan

  • Unit tests for CollectMappedSecrets (success, missing key, missing path, empty, deduplication)
  • Unit tests for config loading with mapping and mutual exclusion validation
  • Compile-time check that vaultProvider implements MultiKeyProvider

@mdemauroy
Copy link
Contributor Author

Hi @BinSquare ! It would be great if you could check my addition to your awesome tool, I'm eager to use it as soon as possible with the multi-key / values vault secrets. It seems to work as intended but since I'm far from being an Go developer and I've received a lot of help from Claude Code youre validation is of course mandatory and required.
Thx 🙏

Copy link
Owner

@BinSquare BinSquare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good!

Some slight changes requested.
Also recommend that you squash commits first.

Thanks for your contribution!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mdemauroy mdemauroy force-pushed the feat/secret-mapping-mode branch from 7b287e6 to d51145f Compare February 17, 2026 10:50
@mdemauroy
Copy link
Contributor Author

Hi @BinSquare thanks a lot for that quick reply !
I've done my best and I hope my changes are ok but feel free to point any mistake.

Thank you for your time 🙏

@mdemauroy mdemauroy requested a review from BinSquare February 17, 2026 10:54
@BinSquare
Copy link
Owner

well done, merging.

@BinSquare BinSquare merged commit fa80966 into BinSquare:main Feb 17, 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.

2 participants