From 2ca07e8102b15e79ee5583f8dc20e49da8836958 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 24 May 2024 00:37:10 +0200 Subject: [PATCH] Check for database configuration --- .../s6-rc.d/init-wpconfig-verify/run | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/rootfs/etc/s6-overlay/s6-rc.d/init-wpconfig-verify/run b/rootfs/etc/s6-overlay/s6-rc.d/init-wpconfig-verify/run index e93afc2..22f3e24 100755 --- a/rootfs/etc/s6-overlay/s6-rc.d/init-wpconfig-verify/run +++ b/rootfs/etc/s6-overlay/s6-rc.d/init-wpconfig-verify/run @@ -43,6 +43,28 @@ checkSaltsEnv() { fi } +checkDatabaseEnv() { + if [ -z "${WORDPRESS_DB_HOST}" ]; then + echo "- WORDPRESS_DB_HOST is not set" + return 1 + fi + + if [ -z "${WORDPRESS_DB_USER}" ]; then + echo "- WORDPRESS_DB_USER is not set" + return 1 + fi + + if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then + echo "- WORDPRESS_DB_PASSWORD is not set" + return 1 + fi + + if [ -z "${WORDPRESS_DB_NAME}" ]; then + echo "- WORDPRESS_DB_NAME is not set" + return 1 + fi +} + # init-wpconfig-verify main main() { # This will prepend service name to all output from here @@ -54,5 +76,10 @@ main() { return 1 fi + echo "Checking database configuration..." + if ! checkDatabaseEnv; then + echo "^^^ Some or all of the database configuration not set. Cannot continue." + return 1 + fi } main