Skip to content

Commit

Permalink
Implement #192 - override config using base64 encoded config in ENVs
Browse files Browse the repository at this point in the history
Closes: #192
Pull-request: #262

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Dec 24, 2019
1 parent ed101c2 commit 8edcc52
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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:
```
Expand Down
10 changes: 10 additions & 0 deletions apache/docker-entrypoint.sh
Expand Up @@ -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 "$@"
10 changes: 10 additions & 0 deletions docker-entrypoint.sh
Expand Up @@ -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 "$@"
10 changes: 10 additions & 0 deletions fpm-alpine/docker-entrypoint.sh
Expand Up @@ -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 "$@"
10 changes: 10 additions & 0 deletions fpm/docker-entrypoint.sh
Expand Up @@ -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 "$@"

0 comments on commit 8edcc52

Please sign in to comment.