-
Notifications
You must be signed in to change notification settings - Fork 8
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
load config from System Properties if present #96
Conversation
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
============================================
+ Coverage 85.69% 86.03% +0.34%
- Complexity 415 425 +10
============================================
Files 40 40
Lines 2076 2098 +22
Branches 194 201 +7
============================================
+ Hits 1779 1805 +26
+ Misses 204 199 -5
- Partials 93 94 +1
|
if(propertyValue == null || propertyValue.equals("")){ | ||
propertyValue = System.getProperty(propertyName); | ||
} | ||
return propertyValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If propertyValue is "" return null, so that we dont have to do !="" check everywhere
return config; | ||
} | ||
|
||
private static Map<String, Object> loadSystemProperties() { | ||
Map<String, Object> systemProperties = new HashMap<>(); | ||
String reporter = getProperty(REPORTER_PROPERTY_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System prop name should be jinsight.reporter (even though the property name is just reporter)
systemProperties.put(API_ENDPOINT_PROPERTY_NAME, apiEndpoint); | ||
} | ||
|
||
String globalTags = getProperty(GLOBAL_TAGS_PROPERTY_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System prop name should be jinsight.global_tags (even though the property name is just global_tags)
} | ||
|
||
private static String getProperty(String propertyName) { | ||
String propertyValue = System.getenv(propertyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not propertyName.contains(".") then propertyName="jinsight."+propertyName
Then all new constants GLOBAL_TAGS_SYSTEM_PROPERTY_NAME REPORTER_SYSTEM_PROPERTY_NAME etc can be deleted
No description provided.