diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-09-08 14:54:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-09-08 14:54:01 +0000 |
commit | 1a8c01a011e0aedfe6ef1f57811429a9133be0ef (patch) | |
tree | dc86c8c87d5899e5cddaaaa25d6ed6d5b4bc3c81 /kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh | |
parent | 0da88c316b62f80976822231b544c280e1a61c50 (diff) | |
parent | 7860146d73472e3b2ff9f7390638ae608c9f9d0f (diff) |
Merge "[CLAMP,COMMON] Escape special chars in mysql passwords"
Diffstat (limited to 'kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh')
-rwxr-xr-x | kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh b/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh index 6c69694011..71f32e2eff 100755 --- a/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh +++ b/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh @@ -18,6 +18,11 @@ for arg; do esac done +prepare_password() +{ + echo "$1" | sed -e "s/'/\\\\'/g; s/\"/\\\\\"/g" +} + # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of @@ -36,7 +41,7 @@ file_env() { elif [ "${!fileVar:-}" ]; then val="$(< "${!fileVar}")" fi - val=`echo -n $val | sed -e "s/'/''/g"` + val=`prepare_password $val` export "$var"="$val" unset "$fileVar" } |