-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Describe the bug
依赖版本:
github.com/rookie-ninja/rk-boot/v2 v2.2.22
github.com/rookie-ninja/rk-cache/redis v1.2.17
github.com/rookie-ninja/rk-db/mongodb v1.2.18
github.com/rookie-ninja/rk-db/redis v1.2.18
github.com/rookie-ninja/rk-entry/v2 v2.2.22
github.com/rookie-ninja/rk-gin/v2 v2.2.23
现象:
- 使用了配置文件:
- 获取配置:rkentry.GlobalAppCtx.GetConfigEntry("config").GetBool("key1.enable")
- 如果使用环境变量:key1_enable,覆盖不了配置文件中的值,
- 需要使用key1.enable,才能覆盖
- 应该是:github.com\rookie-ninja\rk-entry\v2@v2.2.22\entry\config_entry.go
该行:entry.Viper.AutomaticEnv() 前 缺少调用:entry.Viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
期望结果:
使用环境变量:key1_enable,可以覆盖配置文件中的值
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels