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

key auto lower? #293

Closed
elvizlai opened this issue Dec 22, 2016 · 3 comments
Closed

key auto lower? #293

elvizlai opened this issue Dec 22, 2016 · 3 comments

Comments

@elvizlai
Copy link

elvizlai commented Dec 22, 2016

ENV:
    REPO: git@github.com:xyz/abc.git
    WORKDIR: /gopath/src/github.com/xyz/abc
type conf struct {
    ENV    map[string]string
}

Updating viper to newest, the key are all lower.(Previous version works well)

@bep
Copy link
Collaborator

bep commented Dec 22, 2016

Yes, that is a change. The Get* methods are also case insensitive.

@bep bep closed this as completed Dec 22, 2016
@elvizlai
Copy link
Author

Any way to make it sensitive? It is not reasonable.

knadh added a commit to knadh/viper that referenced this issue Jan 25, 2019
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 spf13#131, spf13#260, spf13#293, spf13#371, spf13#373

This commit adds a global function `viper.SetKeyCaseSensitivity()` 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.
knadh added a commit to knadh/viper that referenced this issue Jan 29, 2019
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 spf13#131, spf13#260, spf13#293, spf13#371, spf13#373

This commit adds a global function `viper.SetKeyCaseSensitivity()` 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.
knadh added a commit to knadh/viper that referenced this issue Jan 29, 2019
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 spf13#131, spf13#260, spf13#293, spf13#371, spf13#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.
This was referenced Aug 30, 2019
@sagikazarmark
Copy link
Collaborator

See #1014

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

No branches or pull requests

3 participants