diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-03-31 22:56:00 +0200 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-04-01 02:06:49 +0200 |
commit | 02adcb74d77ece36662834ade0f970f597214c1c (patch) | |
tree | 18ba2def953b5a692dd9020114e20d37e1a96a54 /kubernetes/policy/charts/policy-common/resources/config/scripts | |
parent | ddd1de41d3cc17ad53048bad2c81e2fc1757a5ea (diff) |
[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 <k.opasiak@samsung.com>
Change-Id: I9fc9506b3908da06d0ad221f63d0a56c783788db
Diffstat (limited to 'kubernetes/policy/charts/policy-common/resources/config/scripts')
-rw-r--r-- | kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh | 13 |
1 files changed, 11 insertions, 2 deletions
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 |