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

support expand config keys #1224

Merged
merged 2 commits into from Jul 21, 2021
Merged

support expand config keys #1224

merged 2 commits into from Jul 21, 2021

Conversation

longXboy
Copy link
Member

支持将类似aaa.bbb的key展开成map[aaa]map[bbb]interface{}

这样可以实现通过key来覆盖文件中的结构体value,比如:
spring:
cloud:
consul:
discovery:
catalogServicesWatch:
enabled: false

会被spring.cloud.consul.discovery.catalogServicesWatch.enabled=true 覆盖

config/options.go Outdated Show resolved Hide resolved
@tonybase tonybase merged commit e1228d4 into main Jul 21, 2021
@tonybase tonybase deleted the feature/config_key_expands branch July 21, 2021 15:09
elvizlai pushed a commit to elvizlai/kratos that referenced this pull request Aug 2, 2021
* support expand config keys

* fix bytes in convertMap
@zhuxubin01
Copy link

没看懂意思

是不是这个意思,比如我的config 结构如下

type Config Struct {
DB Struct {
Name string
}
}

c := &Config{}
c.DB.Name = "zhuxubin"
调用load之后不会使用配置文件里面的值?

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.

None yet

4 participants