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

optimize: support configuration metadata read from environment variables #4359

Merged
merged 3 commits into from
Feb 16, 2022
Merged

optimize: support configuration metadata read from environment variables #4359

merged 3 commits into from
Feb 16, 2022

Conversation

slievrly
Copy link
Member

@slievrly slievrly commented Feb 9, 2022

Signed-off-by: slievrly slievrly@163.com

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize: support configuration metadata read from environment variables

After seata-server SpringBoot adaptation, the metadata configuration file is changed from registry.conf to application.yml.
This change causes `ConfigurationFactory#CURRENT_FILE_INSTANCE` to be proxyed by the `SpringBootConfigurationProvider`. 
It lead to fail to `AbstractConfiguration#getConfig` logical priority reads the value of environment variables. 
As immutable infrastructure, Seata-Server Docker should prioritize reading environment variables to reduce intrusion into container images.

Seata-Server SpringBoot 适配改造后,元数据配置文件由registry.conf 变更为 application.yml。这个变更导致了ConfigurationFactory#CURRENT_FILE_INSTANCESpringBootConfigurationProvider 所代理。这将导致未按照AbstractConfiguration#getConfig 的逻辑优先读取环境变量的值。

Seata-Server docker作为不可变基础设施,应优先读取环境变量,减少对容器镜像改造的侵入性。

Ⅱ. Does this pull request fix one issue?

ref #3869

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@slievrly slievrly added the module/config config module label Feb 10, 2022
Signed-off-by: slievrly <slievrly@163.com>
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2022

Codecov Report

Merging #4359 (2cd7036) into develop (732f287) will decrease coverage by 0.07%.
The diff coverage is 44.44%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #4359      +/-   ##
=============================================
- Coverage      48.94%   48.87%   -0.08%     
+ Complexity      3952     3949       -3     
=============================================
  Files            733      733              
  Lines          24968    24974       +6     
  Branches        3088     3090       +2     
=============================================
- Hits           12220    12205      -15     
- Misses         11453    11475      +22     
+ Partials        1295     1294       -1     
Impacted Files Coverage Δ
...gure/provider/SpringBootConfigurationProvider.java 48.27% <40.00%> (+0.06%) ⬆️
...e/src/main/java/io/seata/config/Configuration.java 45.45% <50.00%> (+2.59%) ⬆️
...er/src/main/java/io/seata/server/ServerRunner.java 50.00% <0.00%> (-15.39%) ⬇️
...o/seata/server/coordinator/DefaultCoordinator.java 47.08% <0.00%> (-5.48%) ⬇️
...very/registry/zk/ZookeeperRegisterServiceImpl.java 61.76% <0.00%> (+0.73%) ⬆️

@slievrly slievrly merged commit 031f4c3 into apache:develop Feb 16, 2022
@wangliang181230 wangliang181230 added this to the 1.5.0 milestone Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/config config module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants