Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set keys case sensitive #758

Closed
wants to merge 2 commits into from
Closed

Conversation

gbunt
Copy link

@gbunt gbunt commented Aug 30, 2019

Kudos to @knadh

Add viper.SetKeysCaseSensitive() to disable automatic key lowercasing.

YAML, TOML, and JSON dictate keys to be case-sensitive. Viper's default
behaviour of lowercasing the keys for key insensitivity is incompatible
with these standards and has the side effect of making it difficult for
use cases such as case sensitive API credentials in configuration.
For eg: MyApiKey=MySecret (in TOML).

See #131, #260, #293, #371, #373

This commit adds a global function viper.SetKeysCaseSensitive() that
enables this behaviour to be turned off, after which, all keys, irrespective
of nesting, retain their cases. This respects all configuration operations
including getting, setting, and merging.

@CLAassistant
Copy link

CLAassistant commented Aug 30, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ knadh
❌ gbunt
You have signed the CLA already but the status is still pending? Let us recheck it.

@gbunt gbunt closed this Aug 30, 2019
@gbunt gbunt deleted the SetKeysCaseSensitive branch August 30, 2019 15:48
@gbunt gbunt restored the SetKeysCaseSensitive branch August 30, 2019 15:50
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.

3 participants