From 9dd8371f141942dc7dbe5641a4a2ca3bfae9f168 Mon Sep 17 00:00:00 2001 From: Jeroen Geusebroek Date: Tue, 17 Sep 2019 08:37:31 +0200 Subject: [PATCH] Add support for using a custom database port. --- README.md | 5 ++++- entrypoint.sh | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3c3ad3..48893f9 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,14 @@ When you are done, exit the container (CTRL/CMD-c) and configure the permanent r -e 'TZ=Europe/Amsterdam' \ -e 'SPOTWEB_DB_TYPE=pdo_mysql' \ -e 'SPOTWEB_DB_HOST=' \ + -e 'SPOTWEB_DB_PORT=' \ -e 'SPOTWEB_DB_NAME=spotweb' \ -e 'SPOTWEB_DB_USER=spotweb' \ -e 'SPOTWEB_DB_PASS=spotweb' \ jgeusebroek/spotweb Please NOTE that the volume is optional. Only necessary when you have special configuration settings. +The database port is also optional. If omitted it will use the standard ports MySQL / PostgreSQL. You should now be able to reach the spotweb interface on port 80. @@ -68,7 +70,8 @@ The container will try to auto-update the database when a newer version is relea | --- | --- | | `TZ` | The timezone the server is running in. Defaults to `Europe/Amsterdam`. | | `SPOTWEB_DB_TYPE` | Database type. Use `pdo_mysql` for MySQL. | -| `SPOTWEB_DB_HOST` | The hostname / IP of the database server. | +| `SPOTWEB_DB_HOST` | The database hostname / IP. | +| `SPOTWEB_DB_PORT` | The database port. Optional. | | `SPOTWEB_DB_NAME` | The database used for spotweb. | | `SPOTWEB_DB_USER` | The database server username. | | `SPOTWEB_DB_PASS` | The database server password. | diff --git a/entrypoint.sh b/entrypoint.sh index 4a5e832..57ecfec 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,6 +20,10 @@ if [[ -n "$SPOTWEB_DB_TYPE" && -n "$SPOTWEB_DB_HOST" && -n "$SPOTWEB_DB_NAME" && echo "\$dbsettings['pass'] = '$SPOTWEB_DB_PASS';" >> /config/dbsettings.inc.php fi +if [[ -n "$SPOTWEB_DB_PORT" ]]; then + echo "\$dbsettings['port'] = '$SPOTWEB_DB_PORT';" >> /config/dbsettings.inc.php +fi + if [ -f /config/dbsettings.inc.php ]; then chown www-data:www-data /config/dbsettings.inc.php rm /var/www/spotweb/dbsettings.inc.php