From 1676677dfc4e2b87107bfda1522780f77c1a6c25 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Mon, 8 Nov 2021 20:38:35 +0100 Subject: [PATCH] Update entrypoint to enable an empty table prefix (#100) Update entrypoint to enable an empty table prefix - Who are we to dictate a table prefix - Makes it easier to migrate existing databases that don't have a prefix --- 3.0/apache/entrypoint.sh | 2 +- 3.0/fpm-alpine/entrypoint.sh | 2 +- 3.0/fpm/entrypoint.sh | 2 +- 5.0/apache/entrypoint.sh | 2 +- 5.0/fpm-alpine/entrypoint.sh | 2 +- 5.0/fpm/entrypoint.sh | 2 +- README.md | 2 +- docker-compose.yml | 2 ++ 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/3.0/apache/entrypoint.sh b/3.0/apache/entrypoint.sh index 41b2708..7461682 100755 --- a/3.0/apache/entrypoint.sh +++ b/3.0/apache/entrypoint.sh @@ -89,7 +89,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/3.0/fpm-alpine/entrypoint.sh b/3.0/fpm-alpine/entrypoint.sh index 75ad161..5d93b76 100755 --- a/3.0/fpm-alpine/entrypoint.sh +++ b/3.0/fpm-alpine/entrypoint.sh @@ -82,7 +82,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/3.0/fpm/entrypoint.sh b/3.0/fpm/entrypoint.sh index 75ad161..5d93b76 100755 --- a/3.0/fpm/entrypoint.sh +++ b/3.0/fpm/entrypoint.sh @@ -82,7 +82,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/5.0/apache/entrypoint.sh b/5.0/apache/entrypoint.sh index f6cab90..e69bbae 100755 --- a/5.0/apache/entrypoint.sh +++ b/5.0/apache/entrypoint.sh @@ -96,7 +96,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/5.0/fpm-alpine/entrypoint.sh b/5.0/fpm-alpine/entrypoint.sh index d55c7f9..06e1c14 100755 --- a/5.0/fpm-alpine/entrypoint.sh +++ b/5.0/fpm-alpine/entrypoint.sh @@ -89,7 +89,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/5.0/fpm/entrypoint.sh b/5.0/fpm/entrypoint.sh index d01607d..fec29b5 100755 --- a/5.0/fpm/entrypoint.sh +++ b/5.0/fpm/entrypoint.sh @@ -89,7 +89,7 @@ return array( 'username' => '$DB_USERNAME', 'password' => '$DB_PASSWORD', 'charset' => '$DB_CHARSET', - 'tablePrefix' => '$DB_TABLE_PREFIX', + 'tablePrefix' => '${DB_TABLE_PREFIX//[[:space:]]/}', ), //'session' => array ( // 'class' => 'application.core.web.DbHttpSession', diff --git a/README.md b/README.md index 26a8ec3..f063cc9 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ For further details on the settings see: https://manual.limesurvey.org/Data_encr | DB_PORT | Database server port | | DB_SOCK | Database unix socket instead of host/port | | DB_NAME | Database name | -| DB_TABLE_PREFIX | Database table prefix | +| DB_TABLE_PREFIX | Database table prefix; set this to a single whitespace if you don't want a table prefix. | | DB_MYSQL_ENGINE | MySQL engine used for survey tables (values: MyISAM, InnoDB, default: MyISAM) | | DB_USERNAME | Database user | | DB_PASSWORD | Database user's password | diff --git a/docker-compose.yml b/docker-compose.yml index f7c5fa4..9af73ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,8 @@ services: - "DB_HOST=lime-db" - "DB_PASSWORD=secret" - "ADMIN_PASSWORD=foobar" + # If you require an empty table prefix, use a space as the DB_TABLE_PREFIX + # - "DB_TABLE_PREFIX= " lime-db: image: mysql:5.7 environment: