-
Notifications
You must be signed in to change notification settings - Fork 2k
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
AllKeys returns keys in reverse sorted order #1836
Conversation
This allows users to set configuration that would have precedence on env variable. This is very useful when some post-processing is done on the configuration.
Adding a method to merge config in the override section
Fix AllSettings when some map keys contain the key delimiter
Expose type casting errors
Merge changes from original repo
Try using `UnmarshalStrict`, if it fails, print the errors as a warning and try again with plain `Unmarshal`. Errors look this way: ``` 2019/03/26 15:11:33 warning reading config file: yaml: unmarshal errors: line 6: key "api_key" already set in map ```
…rebased Warn when a yaml file has duplicated keys
This can be used to enforce a config schema
For consistency
By creating a new Viper for each test instead of using the global one
Make tests independent from each other
Enable storing a set of known valid config keys
run `go mod tidy`
Go modules fix
define custom install to make go modules work
Copy CI workflows from `spf13/viper` repo
Setting up codescanning for viper
Before, we would set entries to nil to unset them
Make AllKeys and AllSettings return set-but-empty keys Add Unset method
We want the ability to pull the entire configuration without the default to know what a user explicitly configured
…efault Add a AllSettingsWithoutDefault method
Since this repo is owned by the whole team, any changes should ping all members of this team for reviews.
[CODEOWNERS] Add @DataDog/agent-shared-components as codeowners
return permissions errors when opening config files
Open Source Fork Monitor allowlist
Fix Viper 'UnmarshalKey' behavior to include all sources Viper 'UnmarshalKey' seems to have been designed to work on leaf settings only. When being called on a group of settings, it would not merge all sources (default, env vars, config, override, ...). This means that using the `Set()` method could change the returned value from 'UnmarshalKey' in unexpected ways (i.e. would no longer return the value from the configuration).
This reverts commit c3db1c7.
Viper 'UnmarshalKey' seems to have been designed to work on leaf settings only. When being called on a group of settings, it would not merge all sources (default, env vars, config, override, ...). This means that using the `Set()` method could change the returned value from 'UnmarshalKey' in unexpected ways (i.e. would no longer return the value from the configuration).% The second version of this fix correctly handles env vars override.
👋 Thanks for contributing to Viper! You are awesome! 🎉 A maintainer will take a look at your pull request shortly. 👀 In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues. ⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9 📣 If you've already given us your feedback, you can still help by spreading the news, https://twitter.com/sagikazarmark/status/1306904078967074816 Thank you! ❤️ |
Matthew Hardwick seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Returning keys in a stable manner prevents non-determinism. A bug happening in
allSettings
manifests under certain orders of keys, by using reverse order this bug is never triggered.