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

Extend (legacy)meta server configuration. #1563

Closed
wants to merge 9 commits into from
Closed

Extend (legacy)meta server configuration. #1563

wants to merge 9 commits into from

Conversation

JaredTan95
Copy link
Member

Support to override meta server URL through environment variables.

@codecov-io
Copy link

codecov-io commented Oct 13, 2018

Codecov Report

Merging #1563 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1563      +/-   ##
============================================
+ Coverage     48.62%   48.67%   +0.05%     
- Complexity     1895     1902       +7     
============================================
  Files           393      393              
  Lines         11495    11494       -1     
  Branches       1192     1194       +2     
============================================
+ Hits           5589     5595       +6     
+ Misses         5477     5471       -6     
+ Partials        429      428       -1
Impacted Files Coverage Δ Complexity Δ
...pollo/core/internals/LegacyMetaServerProvider.java 100% <100%> (ø) 9 <3> (+3) ⬆️
.../apollo/internals/RemoteConfigLongPollService.java 77.91% <0%> (+0.61%) 28% <0%> (+1%) ⬆️
...amework/apollo/openapi/util/ConsumerAuditUtil.java 83.33% <0%> (+2.77%) 7% <0%> (+1%) ⬆️
...work/apollo/biz/message/DatabaseMessageSender.java 66.66% <0%> (+10.41%) 8% <0%> (+2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c22ac56...49a8bd8. Read the comment docs.

@nobodyiam
Copy link
Member

Thanks!

Normally, we think system properties have higher priority than system environment properties, is it ok to adjust the logic?

Also, after adding system environment logic, the code looks a little complex, is it better to extract the get meta data logic as a standalone method?

@JaredTan95
Copy link
Member Author

ok,I'll do some refactoring.

@JaredTan95 JaredTan95 closed this Oct 13, 2018
@JaredTan95 JaredTan95 reopened this Oct 13, 2018
@coveralls
Copy link

coveralls commented Oct 13, 2018

Coverage Status

Coverage increased (+0.05%) to 52.401% when pulling 49a8bd8 on JaredTan95:master into c22ac56 on ctripcorp:master.

domains.put(Env.PRO, getMeteServerConf(env, prop, "pro_meta", "pro.meta"));
}

public String getMeteServerConf(Properties env, Properties prop, String sourceName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getMeteServerConf -> getMetaServerAddress

public String getMeteServerConf(Properties env, Properties prop, String sourceName,
String propName) {
// 1. Get from System Property.
String metaAddress = env.getProperty(sourceName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about System.getProperty(sourceName)?

String metaAddress = env.getProperty(sourceName);
if (Strings.isNullOrEmpty(metaAddress)) {
// 2. Get from OS environment variable, which could not contain dot and is normally in UPPER case,like DEV_META.
metaAddress = getenv(sourceName.toUpperCase());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.getenv might be more clear :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tks,😄

@nobodyiam
Copy link
Member

Looks good to me, would you please stash the commits to one commit?

@JaredTan95
Copy link
Member Author

#1565

@JaredTan95 JaredTan95 closed this Oct 14, 2018
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.

4 participants