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

Improvement expand value env #115

Merged
merged 7 commits into from May 28, 2020

Conversation

yankooo
Copy link
Collaborator

@yankooo yankooo commented May 28, 2020

优化yaml文件配置项中环境变量的替换,使得配置项可以进行配置项拼接,更符合shell语法,

eg:
chassis.yaml :

addr1: ${IP||127.0.0.1}:${PORT||80}
addr2: 0.0.0.0:${PORT||80}

如果配置了环境变量PORT=443和IP=10.10.10.10,获得的结果:

addr1: 10.10.10.10:443
addr2: 0.0.0.0:443

如果只配置了环境变量PORT=443,获得的结果:

addr1: 127.0.0.1:443
addr2: 0.0.0.0:443

@tianxiaoliang
Copy link
Member

readme中补下文档

@tianxiaoliang
Copy link
Member

tianxiaoliang commented May 28, 2020

我在想,本来已经有env source,在配置的value中增加place holder的写法,有什么必要性。他满足了怎样的业务场景

@yankooo
Copy link
Collaborator Author

yankooo commented May 28, 2020

因为env配置源的实现,会把下划线改成.,所以有一些场景文件配置源和环境变量配置源有冲突,比如:
microservice.yaml文件中配置微服务的私有性质,由于某些业务原因只有在容器部署的时候才能获取,那么这时候。配置项service_description本身含有下划线,被环境变量配置源解析的时候,会被自动替换成.,这种情况下,service_description.xxx的配置项都会获取不了,因为这个时候archaius里面的配置的key只有service.description.xxx

@tianxiaoliang tianxiaoliang merged commit 6bc1822 into go-chassis:master May 28, 2020
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

2 participants