fix(wordpress): generate distinct MYSQL_PASSWORD and MYSQL_ROOT_PASSWORD (sed -g overwrote both)
This commit is contained in:
+2
-3
@@ -64,9 +64,8 @@ if [ ! -f "$SCRIPT_DIR/.env" ]; then
|
|||||||
# Generate random passwords for local dev
|
# Generate random passwords for local dev
|
||||||
ROOT_PASS=$(openssl rand -hex 16 2>/dev/null || cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1)
|
ROOT_PASS=$(openssl rand -hex 16 2>/dev/null || cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1)
|
||||||
WP_PASS=$(openssl rand -hex 16 2>/dev/null || cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1)
|
WP_PASS=$(openssl rand -hex 16 2>/dev/null || cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1)
|
||||||
sed -i "s/change-me-to-a-strong-password/${ROOT_PASS}/g" "$SCRIPT_DIR/.env"
|
sed -i "0,/change-me-to-a-strong-password/{s/change-me-to-a-strong-password/${ROOT_PASS}/}" "$SCRIPT_DIR/.env"
|
||||||
# Second occurrence is MYSQL_PASSWORD
|
sed -i "s/change-me-to-a-strong-password/${WP_PASS}/" "$SCRIPT_DIR/.env"
|
||||||
sed -i "0,/change-me-to-a-strong-password/{s/change-me-to-a-strong-password/${WP_PASS}/}" "$SCRIPT_DIR/.env"
|
|
||||||
echo -e "${GREEN}✓${NC} Contraseñas generadas en ${SCRIPT_DIR}/.env"
|
echo -e "${GREEN}✓${NC} Contraseñas generadas en ${SCRIPT_DIR}/.env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user