|
@@ -3,9 +3,6 @@
|
|
|
set -eu
|
|
|
|
|
|
readonly WP="/app/code/wp --allow-root"
|
|
|
-readonly admin_password=$(pwgen -1y 16)
|
|
|
-readonly admin_email=${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}
|
|
|
-echo "Admin password is ${admin_password} and email is ${admin_email}"
|
|
|
|
|
|
# Settings to be updated on every run. Regenerating salts means users have to relogin
|
|
|
sed -e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/" \
|
|
@@ -28,6 +25,10 @@ if [[ ! -f "/app/data/.dbsetup" ]]; then
|
|
|
mkdir -p /app/data/wp-content/mu-plugins
|
|
|
cp -r /app/code/wp-content-vanilla/* /app/data/wp-content/
|
|
|
|
|
|
+ readonly admin_password=$(pwgen -1y 16)
|
|
|
+ readonly admin_email=${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}
|
|
|
+ echo "Admin password is ${admin_password} and email is ${admin_email}"
|
|
|
+
|
|
|
# --skip-email is part of 0.23.0 https://github.com/wp-cli/wp-cli/pull/2345 and https://github.com/wp-cli/wp-cli/issues/1164
|
|
|
$WP --url="${APP_ORIGIN}" --skip-email core install \
|
|
|
--url="${APP_ORIGIN}" \
|
|
@@ -81,13 +82,6 @@ $WP option update smtp_auth true
|
|
|
$WP option update smtp_user ${MAIL_SMTP_USERNAME}
|
|
|
$WP option update smtp_pass "${MAIL_SMTP_PASSWORD}"
|
|
|
|
|
|
-# reset the admin password. do this after configuring smtp mail
|
|
|
-echo "Resetting admin password"
|
|
|
-# see http://wp-cli.org/docs/internal-api/wp-cli-add-hook/ and https://codex.wordpress.org/Plugin_API/Filter_Reference/send_password_change_email
|
|
|
-echo "<?php WP_CLI::add_hook('after_wp_load', function () { add_filter( 'send_password_change_email', '__return_false' ); }); ?>" > /run/wordpress/skip-email.php
|
|
|
-$WP --require=/run/wordpress/skip-email.php user update $($WP user get admin --field=ID) --user_pass="${admin_password}"
|
|
|
-$WP --require=/run/wordpress/skip-email.php user update $($WP user get admin --field=ID) --user_email="${admin_email}"
|
|
|
-
|
|
|
# configure LDAP
|
|
|
# https://github.com/heiglandreas/authLdap/blob/master/authLdap.php#L644
|
|
|
echo "Configuring LDAP"
|