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

add config load support env var #309

Merged
merged 1 commit into from
Dec 25, 2020
Merged

add config load support env var #309

merged 1 commit into from
Dec 25, 2020

Conversation

Code-Fight
Copy link
Contributor

增加在配置文件加载时,可以从环境变量中加载相关信息,便于保护私密信息

原有代码:

return loader(content, v)

修改后:

return loader([]byte(os.ExpandEnv(string(content))), v)

相关的test也修改了,具体参考commit文件

@kevwan
Copy link
Contributor

kevwan commented Jan 21, 2021

现在的问题是如果yaml里面需要包含$时就没法弄了,比如 $1

@Code-Fight
Copy link
Contributor Author

@kevwan 峰哥,你的意思是value包含$1 是嘛

比如:

Secret:8jdji728nxid$qw

这种情况嘛?

@kevwan
Copy link
Contributor

kevwan commented Jan 21, 2021

对的

check PR #409

kesonan pushed a commit to kesonan/go-zero that referenced this pull request Mar 1, 2021
jeyrce pushed a commit to jeyrce/go-zero that referenced this pull request Aug 25, 2021
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