From 02adcb74d77ece36662834ade0f970f597214c1c Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Tue, 31 Mar 2020 22:56:00 +0200 Subject: [POLICY] Allow to override username and password from env To avoid hardcoding password in base.conf let's allow to override DB username and password from the environment variable. Issue-ID: OOM-2342 Signed-off-by: Krzysztof Opasiak Change-Id: I9fc9506b3908da06d0ad221f63d0a56c783788db --- .../policy-common/resources/config/scripts/do-start.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'kubernetes/policy/charts') diff --git a/kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh b/kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh index 052b6f2c2f..0e473105a2 100644 --- a/kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh +++ b/kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh @@ -78,8 +78,17 @@ else # wait for DB up # now that DB is up, invoke database upgrade # (which does nothing if the db is already up-to-date) - dbuser=$(echo $(grep '^JDBC_USER=' base.conf | cut -f2 -d=)) - dbpw=$(echo $(grep '^JDBC_PASSWORD=' base.conf | cut -f2 -d=)) + if [[ -v JDBC_USER ]]; then + dbuser=${JDBC_USER}; + else + dbuser=$(echo $(grep '^JDBC_USER=' base.conf | cut -f2 -d=)) + fi + + if [[ -v JDBC_PASSWORD ]]; then + dbpw=${JDBC_PASSWORD} + else + dbpw=$(echo $(grep '^JDBC_PASSWORD=' base.conf | cut -f2 -d=)) + fi db_upgrade_remote.sh $dbuser $dbpw {{.Values.global.mariadb.service.name}} fi -- cgit 1.2.3-korg