Auto-generate a root password for MariaDB installs too.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-08-09 00:58:55 -05:00
parent 1d02320e4c
commit aa50f1d7ab
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
3 changed files with 24 additions and 10 deletions

View File

@ -11,6 +11,10 @@ COMPOSER_PLUGIN_MODE=false
AUTO_ASSIGN_PORT_MIN=8000 AUTO_ASSIGN_PORT_MIN=8000
AUTO_ASSIGN_PORT_MAX=8099 AUTO_ASSIGN_PORT_MAX=8099
# Database passwords
MYSQL_PASSWORD=azur4c457
MYSQL_ROOT_PASSWORD=azur4c457
# Developer options. # Developer options.
# Populate these! # Populate these!
INIT_BASE_URL=http://azuracast.local INIT_BASE_URL=http://azuracast.local

View File

@ -112,18 +112,30 @@ class InstallCommand
// Randomize the MariaDB root password for new installs. // Randomize the MariaDB root password for new installs.
if ($isNewInstall) { if ($isNewInstall) {
if (!$devMode && 'azur4c457' === $azuracastEnv[Environment::DB_PASSWORD]) { if ($devMode) {
$azuracastEnv[Environment::DB_PASSWORD] = Strings::generatePassword(12); if (empty($azuracastEnv['MYSQL_ROOT_PASSWORD'])) {
} $azuracastEnv['MYSQL_ROOT_PASSWORD'] = 'azur4c457_root';
}
} else {
if (
empty($azuracastEnv[Environment::DB_PASSWORD])
|| 'azur4c457' === $azuracastEnv[Environment::DB_PASSWORD]
) {
$azuracastEnv[Environment::DB_PASSWORD] = Strings::generatePassword(12);
}
if (empty($azuracastEnv['MYSQL_ROOT_PASSWORD'])) { if (empty($azuracastEnv['MYSQL_ROOT_PASSWORD'])) {
$azuracastEnv['MYSQL_RANDOM_ROOT_PASSWORD'] = 'no'; $azuracastEnv['MYSQL_ROOT_PASSWORD'] = Strings::generatePassword(20);
$azuracastEnv['MYSQL_ROOT_PASSWORD'] = ($devMode) }
? 'azur4c457'
: Strings::generatePassword(20);
} }
} }
if (!empty($azuracastEnv['MYSQL_ROOT_PASSWORD'])) {
unset($azuracastEnv['MYSQL_RANDOM_ROOT_PASSWORD']);
} else {
$azuracastEnv['MYSQL_RANDOM_ROOT_PASSWORD'] = 'yes';
}
// Display header messages // Display header messages
if ($isNewInstall) { if ($isNewInstall) {
$io->title( $io->title(

View File

@ -136,8 +136,6 @@ class AzuraCastEnvFile extends AbstractEnvFile
'description' => __( 'description' => __(
'Do not modify this after installation.', 'Do not modify this after installation.',
), ),
'default' => 'yes',
'required' => true,
], ],
'MYSQL_ROOT_PASSWORD' => [ 'MYSQL_ROOT_PASSWORD' => [
'name' => __('MariaDB Root Password'), 'name' => __('MariaDB Root Password'),