From 8edcc52dfbc91086c0b708665f7d0eebe141b423 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 24 Dec 2019 11:12:31 +0100 Subject: [PATCH] Implement #192 - override config using base64 encoded config in ENVs Closes: #192 Pull-request: #262 Signed-off-by: William Desportes --- README.md | 2 ++ apache/docker-entrypoint.sh | 10 ++++++++++ docker-entrypoint.sh | 10 ++++++++++ fpm-alpine/docker-entrypoint.sh | 10 ++++++++++ fpm/docker-entrypoint.sh | 10 ++++++++++ 5 files changed, 42 insertions(+) diff --git a/README.md b/README.md index 338a015..1f534a4 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,8 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma * ``PMA_ABSOLUTE_URI`` - define user-facing URI * ``HIDE_PHP_VERSION`` - if defined, will hide the php version (`expose_php = Off`). Set to any value (such as HIDE_PHP_VERSION=true). * ``UPLOAD_LIMIT`` - if set, will override the default value for apache and php-fpm (default value is 2048 kb) +* ``PMA_CONFIG_BASE64`` - if set, will override the default config.inc.php with the base64 decoded contents of the variable +* ``PMA_USER_CONFIG_BASE64`` - if set, will override the default config.user.inc.php with the base64 decoded contents of the variable For usage with Docker secrets, appending ``_FILE`` to any environment variable is allowed: ``` diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index ed6c182..00f9d17 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -64,4 +64,14 @@ else fi fi +if [ ! -z "${PMA_CONFIG_BASE64}" ]; then + echo "Adding the custom config.inc.php from base64." + echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php +fi + +if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then + echo "Adding the custom config.user.inc.php from base64." + echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php +fi + exec "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 061f9f3..79c4d23 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -59,4 +59,14 @@ if [ ! -z "${UPLOAD_LIMIT}" ]; then echo -e "upload_max_filesize = $UPLOAD_LIMIT\npost_max_size = $UPLOAD_LIMIT\n" > $UPLOAD_LIMIT_INI_FILE fi +if [ ! -z "${PMA_CONFIG_BASE64}" ]; then + echo "Adding the custom config.inc.php from base64." + echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php +fi + +if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then + echo "Adding the custom config.user.inc.php from base64." + echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php +fi + exec "$@" diff --git a/fpm-alpine/docker-entrypoint.sh b/fpm-alpine/docker-entrypoint.sh index ed6c182..00f9d17 100755 --- a/fpm-alpine/docker-entrypoint.sh +++ b/fpm-alpine/docker-entrypoint.sh @@ -64,4 +64,14 @@ else fi fi +if [ ! -z "${PMA_CONFIG_BASE64}" ]; then + echo "Adding the custom config.inc.php from base64." + echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php +fi + +if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then + echo "Adding the custom config.user.inc.php from base64." + echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php +fi + exec "$@" diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index ed6c182..00f9d17 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -64,4 +64,14 @@ else fi fi +if [ ! -z "${PMA_CONFIG_BASE64}" ]; then + echo "Adding the custom config.inc.php from base64." + echo "${PMA_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.inc.php +fi + +if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then + echo "Adding the custom config.user.inc.php from base64." + echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php +fi + exec "$@"