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: config overwritten by default values #416

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

hello-wn
Copy link
Contributor

背景

在测试busext时,发现config中传入的配置没有生效。其他ext如果在init时设置默认值,也有问题。

问题

GetConfigByPrefix中使用subConfig.SetDefault( )读取配置,给相应变量设置默认值之后,又会被extension初始化时设置的默认值替换掉。按照viper的配置优先级,读取配置应该直接Set,在ext初始化时,使用SetDefault

image

@fenngwd
Copy link
Contributor

fenngwd commented Aug 15, 2022

LGTM

@fenngwd fenngwd merged commit 3157fb5 into shanbay:master Aug 15, 2022
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