Skip to content

Commit

Permalink
Merge pull request #34 from msmith-techempower/envvar-config
Browse files Browse the repository at this point in the history
Support both System.properties and envvars
  • Loading branch information
msmith-techempower committed Jan 30, 2019
2 parents bce3da1 + 5f6f887 commit dcbc4c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gemini/src/main/java/com/techempower/gemini/Configurator.java
Expand Up @@ -288,6 +288,12 @@ protected EnhancedProperties constructProperties()
// Create a new properties object for each provider to use.
final EnhancedProperties props = new EnhancedProperties(application);

// Add system properties passed
for (Map.Entry<Object, Object> entry : System.getProperties().entrySet())
{
props.put(entry.getKey().toString(), entry.getValue().toString());
}

// Add system environment variables with the "Environment." prefix.
for (Map.Entry<String, String> entry : System.getenv().entrySet())
{
Expand Down
Expand Up @@ -319,6 +319,12 @@ else if (System.getProperty(GeminiConstants.CONFIGURATION_FILE) != null)
filenames = System.getProperty(GeminiConstants.CONFIGURATION_FILE);
log.log("Using specified configuration file(s): " + filenames);
}
else if (System.getenv(GeminiConstants.CONFIGURATION_FILE) != null)
{
// Use configuration file names specified in an environment variable
filenames = System.getenv(GeminiConstants.CONFIGURATION_FILE);
log.log("Using specified configuration file(s): " + filenames);
}
else
{
// Attempt to load a machine-specific configuration file.
Expand Down

0 comments on commit dcbc4c7

Please sign in to comment.