structured config #1: introduce mapstructure decoder for yaml parsing#2628
Conversation
710f3a7 to
72dff61
Compare
39b625e to
3fb3c1f
Compare
7f8def6 to
cd566ee
Compare
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
4941bf1 to
629ac24
Compare
a0420ca to
f93271a
Compare
remove color output in tests for better readability in github actions bugfix: remove google as default provider for alpha options fix conversion flow for toml to yaml revert ginkgo color deactivation revert claim- and secret source back to pointers regenerate alpha config Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
…oleans to pointers Signed-off-by: Jan Larwig <jan@larwig.com>
f93271a to
15041dd
Compare
| ), | ||
| Metadata: nil, // Don't track any metadata | ||
| Result: result, // Decode the result into the prefilled options | ||
| TagName: "yaml", // Parse all fields that use the json tag |
There was a problem hiding this comment.
Comment isn't updated based on this thread, also says json tag which is wrong
| // TBD: Uncomment as we add EnsureDefaults methods | ||
| // o.Cookie.EnsureDefaults() | ||
| // o.Session.EnsureDefaults() | ||
| // o.Templates.EnsureDefaults() | ||
| // o.Logging.EnsureDefaults() |
There was a problem hiding this comment.
When there is child defaulting to do, how do we ensure as we add new fields that we remember to call the default?
There was a problem hiding this comment.
I was already thinking about the issue on how to enforce that the EnsureDefaults() is called but didn't have a satisfactory idea yet
Signed-off-by: Jan Larwig <jan@larwig.com>
| injectResponseHeaders: | ||
| - name: X-Secret | ||
| values: | ||
| - value: c2VjcmV0 | ||
| - secretSource: | ||
| value: secret |
There was a problem hiding this comment.
This is now at odds with the documentation, which still says (in many places) that a secretSource value needs to be base64 encoded.
Description
This PR introduces mapstructure for decoding and encoding the yaml files. Mapstructure is a defacto standard library used by many libraries like spf13/viper for more dynamic data loading between different interfaces.
Just using the golang json / yaml encoding / decoding would lead to overwriting the default set before loading the config file. Trying to load the default configs afterwards would be rather hard or impossible.
Motivation and Context
Cases to consider:
falsein the config file or if it was set to the boolean default of false. This is problematic as we have boolean likeCookie.Securethat are supposed to be set totrueby default.HeaderValueseither being aSecretSourceorClaimSource. Which isn't supported by the default json / yaml parsertimeprimitives likeDurationorTimethrough strings. If you want to be able to configureDurationtypes with values like2h. You need to implement a custom wrapper type and Marshal and Unmarshal method. Mapstructure allows for decoding hooks through the usage of relection.How Has This Been Tested?
Checklist: