Code Review
/
policy
/
engine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Allow storing database password in environment variables
[policy/engine.git]
/
LogParser
/
src
/
main
/
java
/
org
/
onap
/
xacml
/
parser
/
ParseLog.java
diff --git
a/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java
b/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java
index
f12522a
..
77aafdf
100644
(file)
--- a/
LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java
+++ b/
LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java
@@
-884,11
+884,11
@@
public class ParseLog {
setLogFileProperties(splitString);
jdbcUrl = config.getProperty("JDBC_URL").replace("'", "");
setLogFileProperties(splitString);
jdbcUrl = config.getProperty("JDBC_URL").replace("'", "");
- jdbcUser =
config.getProperty("JDBC_USER"
);
+ jdbcUser =
getValue(config.getProperty("JDBC_USER")
);
jdbcDriver = config.getProperty("JDBC_DRIVER");
PeCryptoUtils.initAesKey(config.getProperty(PROP_AES_KEY));
jdbcDriver = config.getProperty("JDBC_DRIVER");
PeCryptoUtils.initAesKey(config.getProperty(PROP_AES_KEY));
- jdbcPassword = PeCryptoUtils.decrypt(
config.getProperty("JDBC_PASSWORD"
));
+ jdbcPassword = PeCryptoUtils.decrypt(
getValue(config.getProperty("JDBC_PASSWORD")
));
config.setProperty("javax.persistence.jdbc.password", jdbcPassword);
return config;
config.setProperty("javax.persistence.jdbc.password", jdbcPassword);
return config;
@@
-902,6
+902,13
@@
public class ParseLog {
return null;
}
return null;
}
+ private static String getValue(final String value) {
+ if (value != null && value.matches("[$][{].*[}]$")) {
+ return System.getenv(value.substring(2, value.length() - 1));
+ }
+ return value;
+ }
+
public static Connection getDbConnection() {
return dbConnection(jdbcDriver, jdbcUrl, jdbcUser, jdbcPassword);
}
public static Connection getDbConnection() {
return dbConnection(jdbcDriver, jdbcUrl, jdbcUser, jdbcPassword);
}