Skip to content

Commit

Permalink
update wp admin password generation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriipavlov committed Jul 24, 2024
1 parent 36dc093 commit d012193
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sh/env/.env.secret.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WP_DB_CHARSET=utf8mb4
# Default admin for WorPress installation
WP_ADMIN_USER=admin
[email protected]
#WP_ADMIN_PASSWORD will be generated in installation script
WP_ADMIN_PASSWORD=generate_this_pass

# Authentication unique keys and salts
WP_AUTH_KEY='generate_key'
Expand Down
5 changes: 2 additions & 3 deletions sh/wp-cli/core-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ if [ -z "$WP_HOME" ]; then
echo -e "${LIGHTRED}[Error]${NOCOLOR} WP_HOME is not defined in wp-config.php"; exit 1;
fi

WP_ADMIN_PASSWORD=$(tr -dc 'A-Za-z0-9_' </dev/urandom | head -c 25)

# Use WP_HOME, WP_ADMIN_USER, WP_ADMIN_EMAIL from .env
# Using WP_HOME, WP_ADMIN_USER, WP_ADMIN_EMAIL, WP_ADMIN_PASSWORD from .env.secret file
# Run the wp core install command and capture its output in a variable
wp core install \
--url="$WP_HOME" \
Expand All @@ -33,4 +31,5 @@ wp rewrite structure '/%postname%/' --hard

echo -e "${LIGHTGREEN}[Success]${NOCOLOR} Admin username: ${LIGHTYELLOW}$WP_ADMIN_USER${NOCOLOR}"
echo -e "${LIGHTGREEN}[Success]${NOCOLOR} Admin password: ${LIGHTYELLOW}$WP_ADMIN_PASSWORD${NOCOLOR}"
echo -e "${CYAN}[Info]${NOCOLOR} You can find this credentials in 'config/environment/.env.secret' file"
echo -e "${LIGHTYELLOW}[Warning]${NOCOLOR} Store your password in safe place"

0 comments on commit d012193

Please sign in to comment.