61 lines
1.9 KiB
Bash
61 lines
1.9 KiB
Bash
|
#!/bin/bash
|
|||
|
set -eo pipefail
|
|||
|
|
|||
|
cd /app/public
|
|||
|
|
|||
|
|
|||
|
if [[ ! -f /app/public/wp-config.php ]]
|
|||
|
then
|
|||
|
wp config create \
|
|||
|
--allow-root \
|
|||
|
--dbhost="${WORDPRESS_DB_HOST}" \
|
|||
|
--dbname="${WORDPRESS_DB_NAME}" \
|
|||
|
--dbuser="${WORDPRESS_DB_USER}" \
|
|||
|
--dbpass="${WORDPRESS_DB_PASSWORD}" \
|
|||
|
--dbcharset="utf8mb4" \
|
|||
|
--locale="fr_FR"
|
|||
|
fi
|
|||
|
|
|||
|
wp core multisite-install \
|
|||
|
--allow-root \
|
|||
|
--url="${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}" \
|
|||
|
--title="${WORDPRESS_TITLE}" \
|
|||
|
--admin_user="${WORDPRESS_USER}" \
|
|||
|
--admin_password="${WORDPRESS_PASSWORD}" \
|
|||
|
--admin_email="${WORDPRESS_EMAIL}" \
|
|||
|
--skip-email
|
|||
|
|
|||
|
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
|
|||
|
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
|
|||
|
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
|
|||
|
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
|
|||
|
|
|||
|
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
|||
|
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
|
|||
|
|
|||
|
wp config set --allow-root WP_ALLOW_MULTISITE true
|
|||
|
wp config set --allow-root MULTISITE true
|
|||
|
wp config set --allow-root SUBDOMAIN_INSTALL false
|
|||
|
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
|
|||
|
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
|
|||
|
wp config set --allow-root FORCE_ADMIN_SSL false
|
|||
|
|
|||
|
|
|||
|
# On fait croire à WP qu'il est en https
|
|||
|
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then
|
|||
|
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
|||
|
then
|
|||
|
echo "FORCE HTTPS already set"
|
|||
|
fi
|
|||
|
else
|
|||
|
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
|
|||
|
then
|
|||
|
echo "FORCE HTTPS set"
|
|||
|
head -n 1 "wp-config.php" > "wp-config.tmp"
|
|||
|
echo "\$_SERVER['HTTPS']='on';" >> "wp-config.tmp"
|
|||
|
tail -n +2 "wp-config.php" >> "wp-config.tmp"
|
|||
|
mv "wp-config.tmp" "wp-config.php"
|
|||
|
fi
|
|||
|
fi
|
|||
|
|
|||
|
exec $@
|