Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Feb 9, 2012
1 parent 818234c commit 83da03b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -24,7 +24,7 @@ public class PropertiesLoader implements Serializable {
* @return a map containing all the file properties content
* @throws EnvInjectException
*/
public Map<String, String> getVarsFromPropertiesFile(File propertiesFile) throws EnvInjectException {
public Map<String, String> getVarsFromPropertiesFile(File propertiesFile, Map<String, String> currentEnvVars) throws EnvInjectException {

if (propertiesFile == null) {
throw new NullPointerException("The properties file object must be set.");
Expand All @@ -39,7 +39,8 @@ public Map<String, String> getVarsFromPropertiesFile(File propertiesFile) throws
try {
String fileContent = Util.loadFile(propertiesFile);
fileContent = processWindowsFilePath(fileContent);
properties.load(new StringReader(fileContent));
String fileContentResolved = Util.replaceMacro(fileContent, currentEnvVars);
properties.load(new StringReader(fileContentResolved));
} catch (IOException ioe) {
throw new EnvInjectException("Problem occurs on loading content", ioe);
}
Expand Down
Expand Up @@ -49,7 +49,7 @@ public Map<String, String> invoke(File base, VirtualChannel channel) throws IOEx
throw new EnvInjectException(message);
}
logger.info(String.format("Injecting as environment variables the properties file path '%s'", propertiesFilePathResolved));
result.putAll(loader.getVarsFromPropertiesFile(propertiesFile));
result.putAll(loader.getVarsFromPropertiesFile(propertiesFile, currentEnvVars));
logger.info("Variables injected successfully.");
}

Expand Down

0 comments on commit 83da03b

Please sign in to comment.