Explorar o código

Additional params

Alex Trofimov %!s(int64=6) %!d(string=hai) anos
pai
achega
a1bb69405a
Modificáronse 2 ficheiros con 15 adicións e 2 borrados
  1. 2 0
      README.md
  2. 13 2
      docker-entrypoint.sh

+ 2 - 0
README.md

@@ -31,3 +31,5 @@ Above example assumes that UNA is run locally with mysql server installed on the
 - `UNA_ZIP_DOWNLOAD_URL` - custom UNA download URL, in case you need to install modified version, optional
 - `UNA_ZIP_FOLDER` - custom UNA folder in `UNA_ZIP_DOWNLOAD_URL` zip to be able to unpack, UNA is aleays installed in root folder 
 - `UNA_NO_CRONTAB` - don't install crontab, in case of multiple instances, cron should be installed on one instance only, cron is installed by default
+- `UNA_DB_ENGINE` - MySQL DB engine, please note that some DB engines require custom MySQL server configuration, default `MYISAM` 
+- `UNA_AUTO_HOSTNAME` - when this option is set (other than zero) then `UNA_HTTP_HOST` option is ignored and current hostname (where site is requested) is used. 

+ 13 - 2
docker-entrypoint.sh

@@ -1,8 +1,6 @@
 #!/bin/bash
 set -euox pipefail
 
-# TODO: escape vars
-
 UNA_USER="www-una"
 
 VAR_DEF_DB_HOST="localhost"
@@ -15,6 +13,9 @@ VAR_DEF_USERNAME="admin"
 VAR_DEF_ADMIN_PWD="admin"
 VAR_DEF_EMAIL="admin@example.com"
 
+VAR_DEF_DB_ENGINE="MYISAM"
+VAR_DEF_AUTO_HOSTNAME=0
+
 VAR_DEF_VERSION="11.0.3"
 VAR_DEF_ZIP_DOWNLOAD_URL="http://ci.una.io/builds/UNA-v.${UNA_VERSION:-$VAR_DEF_VERSION}.zip"
 VAR_DEF_ZIP_FOLDER="UNA-v.${UNA_VERSION:-$VAR_DEF_VERSION}"
@@ -68,6 +69,16 @@ if [ -d "install" ] && [ ! -f "inc/header.inc.php" ]; then
     rm -rf ./install
 fi
 
+# Config alteration
+
+if [ ${UNA_DB_ENGINE:-$VAR_DEF_DB_ENGINE} != "MYISAM" ]; then
+    sed -r -i "s/^define\('BX_DATABASE_ENGINE', 'MYISAM'\);/define\('BX_DATABASE_ENGINE', '${UNA_DB_ENGINE:-$VAR_DEF_DB_ENGINE}'\);/g" /var/www/html/inc/header.inc.php
+fi
+
+if [ ${UNA_AUTO_HOSTNAME:-$VAR_DEF_AUTO_HOSTNAME} != 0 ]; then
+    sed -r -i "s/^define\('BX_DOL_URL_ROOT', .*?;/define\('BX_DOL_URL_ROOT', \(\(isset\(\$_SERVER['HTTPS']\) \&\& \$_SERVER['HTTPS'] == 'on'\) || \(!empty\(\$_SERVER['HTTP_X_FORWARDED_PROTO']\) \&\& \$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty\(\$_SERVER['HTTP_X_FORWARDED_SSL']\) \&\& \$_SERVER['HTTP_X_FORWARDED_SSL'] == 'on'\) ? 'https' : 'http'\) . ':\/\/' . \$_SERVER['HTTP_HOST'] . '\/'\);/g" /var/www/html/inc/header.inc.php
+fi
+
 # Crontab
 
 if [[ ! -v UNA_NO_CRONTAB ]]; then