Bladeren bron

Update the admin email on every run

Girish Ramakrishnan 9 jaren geleden
bovenliggende
commit
3076048f46
1 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 3 3
      start.sh

+ 3 - 3
start.sh

@@ -4,7 +4,8 @@ set -eux
 
 readonly WP="/app/code/wp --allow-root"
 readonly admin_password=$(pwgen -1)
-echo "Admin password is ${admin_password}"
+readonly admin_email=${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}
+echo "Admin password is ${admin_password} and email is ${admin_email}"
 
 if [[ -z "$(ls -A /app/data)" ]]; then
     echo "Copying wp-content files on first run"
@@ -32,8 +33,6 @@ if [[ -z "$(ls -A /app/data)" ]]; then
     }
 EOF
 
-    readonly admin_email=${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}
-
     $WP --url="https://$(hostname -f)" core install \
         --url="https://$(hostname -f)" \
         --title="My blog" \
@@ -68,6 +67,7 @@ sed -e "s/define('DB_NAME',.*/define('DB_NAME', '${MYSQL_DATABASE}');/" \
 
 # reset the admin password
 $WP user update $($WP user get admin --field=ID) --user_pass="${admin_password}"
+$WP user update $($WP user get admin --field=ID) --user_email="${admin_email}"
 
 # configure WP mail smtp plugin (smtp_user, smtp_pass can be set when supported)
 $WP option update mailer smtp