summaryrefslogtreecommitdiffstats
path: root/restapi-call-node/provider/src/main/java
diff options
context:
space:
mode:
authorAgarwal, Ruchira (ra1926) <ra1926@att.com>2019-07-22 20:26:50 +0000
committerAgarwal, Ruchira (ra1926) <ra1926@att.com>2019-07-23 14:55:23 +0000
commit57bfbb05e485fb11b620b1bf12e70aa063aaa3c8 (patch)
tree434a13e13cf45004a91f309e86c76038cf1d27af /restapi-call-node/provider/src/main/java
parent1201ff98e4c7856b03b268302e4aed2cdc6e1dbb (diff)
configurable param resolution
support config parameter resolution to k8s secret value Issue-ID: CCSDK-1502 Signed-off-by: Agarwal, Ruchira (ra1926) <ra1926@att.com> Change-Id: I8acc98fa3fdd9ba46c617b4d0113086c1e889997
Diffstat (limited to 'restapi-call-node/provider/src/main/java')
-rwxr-xr-xrestapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
index 220e18fd0..c539010fb 100755
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
@@ -141,7 +141,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
}
String userName = partnerObject.getString(partnerUserKey);
String password = partnerObject.getString(partnerPasswordKey);
- PartnerDetails details = new PartnerDetails(userName, password, url);
+ PartnerDetails details = new PartnerDetails(userName, getObfuscatedVal(password), url);
partnerStore.put(partnerKey, details);
log.info("mapped partner using partner key " + partnerKey);
} else {
@@ -153,6 +153,25 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
}
}
+ /* Unobfuscate param value */
+ private static String getObfuscatedVal(String paramValue) {
+ String resValue = paramValue;
+ if (paramValue != null && paramValue.startsWith("${") && paramValue.endsWith("}"))
+ {
+ String paramStr = paramValue.substring(2, paramValue.length()-1);
+ if (paramStr != null && paramStr.length() > 0)
+ {
+ String val = System.getenv(paramStr);
+ if (val != null && val.length() > 0)
+ {
+ resValue=val;
+ log.info("Obfuscated value RESET for param value:" + paramValue);
+ }
+ }
+ }
+ return resValue;
+ }
+
/**
* Returns parameters from the parameter map.
*