Solves an issue of hardwiring user/password in wordpress for database.

This commit is contained in:
Jonathan Rosenbaum 2025-06-08 22:07:27 +00:00
parent 075cfed0c5
commit 4ace5fb035
2 changed files with 6 additions and 4 deletions

View File

@ -47,6 +47,8 @@ services:
environment:
- WORDPRESS_DB_HOST=database_${COMPOSE_PROJECT_NAME}:3306
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD:-fake}
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
- MYSQL_USER=${MYSQL_USER:-wordpress}
- VIRTUAL_HOST=${VIRTUAL_HOST:-wordpress}
- LETSENCRYPT_HOST=${LETSENCRYPT_HOST:-wordpress}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-me}

View File

@ -20,13 +20,13 @@
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
define('DB_NAME', getenv('MYSQL_DATABASE'));
/** MySQL database username */
define('DB_USER', 'root');
define('DB_USER', getenv('MYSQL_USER'));
/** MySQL database password */
define('DB_PASSWORD', 'wordpress');
define('DB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD'));
/** MySQL hostname */
define('DB_HOST', getenv('WORDPRESS_DB_HOST'));