From 985ebabbe473debecf51d12307259d312d663dc5 Mon Sep 17 00:00:00 2001
From: TeoGoddet <9885447+TeoGoddet@users.noreply.github.com>
Date: Thu, 2 Apr 2020 17:50:39 +0200
Subject: [PATCH] Update docker-entrypoint.sh

XDOCKER-131: docker-entrypoint doen't set database
---
 template/xwiki/docker-entrypoint.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/template/xwiki/docker-entrypoint.sh b/template/xwiki/docker-entrypoint.sh
index e40a677..5b7ac73 100755
--- a/template/xwiki/docker-entrypoint.sh
+++ b/template/xwiki/docker-entrypoint.sh
@@ -128,6 +128,10 @@ function configure() {
   safesed "replacecontainer" \$DB_HOST /usr/local/tomcat/webapps/\$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
   safesed "replacedatabase" \$DB_DATABASE /usr/local/tomcat/webapps/\$CONTEXT_PATH/WEB-INF/hibernate.cfg.xml
 
+  if [ "$DB_DATABASE" != "xwiki" ]; then
+    xwiki_set_cfg "xwiki.db" $DB_DATABASE
+  fi
+
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
-- 
GitLab