Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 19f165725 -> 8722e5bba


TAMAYA-340 Enhanced environment property resolution.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/8722e5bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8722e5bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8722e5bb

Branch: refs/heads/master
Commit: 8722e5bba0084f3755bf685aa7d8a18cabda6e95
Parents: 19f1657
Author: Anatole Tresch <[email protected]>
Authored: Tue Jun 5 11:38:20 2018 +0200
Committer: Anatole Tresch <[email protected]>
Committed: Tue Jun 5 11:38:20 2018 +0200

----------------------------------------------------------------------
 .../propertysource/EnvironmentPropertySource.java    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8722e5bb/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git 
a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
 
b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
index a8badbe..40e6c45 100644
--- 
a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
+++ 
b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
@@ -197,12 +197,19 @@ public class EnvironmentPropertySource extends 
BasePropertySource {
         if (isDisabled()) {
             return null;
         }
-
+        // Exact match (i.e. com.ACME.size)
         String effectiveKey = hasPrefix() ? getPrefix() + "." + key
-                                          : key;
-
+                : key;
         String value = getPropertiesProvider().getenv(effectiveKey);
-
+        // Replace all . by _ (i.e. com_ACME_size)
+        if(value==null){
+            value = 
getPropertiesProvider().getenv(effectiveKey.replaceAll(".", "_"));
+        }
+        // Replace all . by _ and convert to upper case (i.e. COM_ACME_SIZE)
+        if(value==null){
+            value = 
getPropertiesProvider().getenv(effectiveKey.replaceAll(".", "_")
+                    .toUpperCase());
+        }
         return PropertyValue.of(key, value, getName());
     }
 

Reply via email to