Fall back to ENV variables if no replacement is found

Description

Currently, only variables set as framework property or defined as -Dprop=value are picked up by the replacement. We would like to use ENV variables (through System.getEnv()) as fallback when none of the aforementioned options have been configured.

Eg. something along those lines:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 diff --git a/org.amdatu.configurator/src/org/amdatu/configurator/util/FrameworkPropertyReplacer.java b/org.amdatu.configurator/src/org/amdatu/configurator/util/FrameworkPropertyReplacer.java index 650826a..d9b6e5b 100644 --- a/org.amdatu.configurator/src/org/amdatu/configurator/util/FrameworkPropertyReplacer.java +++ b/org.amdatu.configurator/src/org/amdatu/configurator/util/FrameworkPropertyReplacer.java @@ -41,6 +41,13 @@ public class FrameworkPropertyReplacer implements Replacer { if (input.startsWith(m_prefix)) { input = input.substring(m_prefix.length()); } - return m_context.getProperty(input); + + String bundleContextProperty = m_context.getProperty(input); + + if (bundleContextProperty == null) { + return System.getenv(input); + } + + return bundleContextProperty; } }

Status

Assignee

Unassigned

Reporter

Sander Mak

Labels

None

Fix versions

Priority

Major
Configure