From a2466956ec6b368659ec21ac2627a79baef55ca7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 18 May 2021 12:18:48 +0545 Subject: [PATCH] fix filter and mysql root password --- app/config/variables.php | 9 +++++++++ app/tasks/install.php | 20 ++++++++++++++------ app/views/install/compose.phtml | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 72b69e272..334561541 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -243,6 +243,15 @@ return [ 'question' => '', 'filter' => 'password' ], + [ + 'name' => '_APP_DB_ROOT_PASS', + 'description' => 'MariaDB server root password. Default value is: \'rootsecretpassword\'.', + 'introduction' => '', + 'default' => 'rootsecretpassword', + 'required' => false, + 'question' => '', + 'filter' => 'password' + ], ], ], [ diff --git a/app/tasks/install.php b/app/tasks/install.php index 3cd1c37dd..7becef9d6 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -127,12 +127,20 @@ $cli foreach($vars as $key => $var) { if(!empty($var['filter']) && ($interactive !== 'Y' || !Console::isInteractive())) { - $input[$var['name']] = ($data && $var['default'] !== null) - ? $var['default'] - :( $var['filter'] === 'token' - ? Auth::tokenGenerator() - : Auth::passwordGenerator()); - continue; + if($data && $var['default'] !== null) { + $input[$var['name']] = $var['default']; + continue; + } + + if($var['filter'] === 'token') { + $input[$var['name']] = Auth::tokenGenerator(); + continue; + } + + if($var['filter'] === 'password') { + $input[$var['name']] = Auth::passwordGenerator(); + continue; + } } if(!$var['required'] || !Console::isInteractive() || $interactive !== 'Y') { $input[$var['name']] = $var['default']; diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index fbd89ff2a..644d7f6e5 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -339,7 +339,7 @@ services: volumes: - appwrite-mariadb:/var/lib/mysql:rw environment: - - MYSQL_ROOT_PASSWORD=rootsecretpassword + - MYSQL_ROOT_PASSWORD=${_APP_DB_ROOT_PASS} - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS}