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

Fix the bug that the default configs of slice/map are not overridden #497

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

dxsup
Copy link
Member

@dxsup dxsup commented Apr 3, 2023

Description

Set zeroFields=true when using viper.Unmarshal to override the default configs of slice/map.

Motivation and Context

Every component has a default configuration when registering to the factory. When unmarshalling the configuration file to the struct, the slices/maps in the configuration and the default one are merged which is not what we expected. This PR adds the option zeroFields=true to viper.Unmarshal for overriding the default configs of slice/map.

How Has This Been Tested?

PASS
ok      github.com/Kindling-project/kindling/collector/internal/application     0.489s

…t value

Signed-off-by: Daxin Wang <daxinwang@harmonycloud.cn>
@dxsup dxsup requested a review from NeJan2020 April 3, 2023 08:46
Daxin Wang added 2 commits April 3, 2023 16:47
Signed-off-by: Daxin Wang <daxinwang@harmonycloud.cn>
Signed-off-by: Daxin Wang <daxinwang@harmonycloud.cn>
@dxsup dxsup merged commit 9082a6e into KindlingProject:main Apr 3, 2023
@dxsup dxsup deleted the fix/config-slice-override branch April 3, 2023 09:39
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