improve command

This commit is contained in:
Daniel Seifert 2024-11-06 22:27:08 +01:00
parent 4a198320ce
commit dac1b6ecf9
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170

View File

@ -20,12 +20,7 @@ task('setup:createDbConfig', function () {
run("touch {{db_conf_path}}"); run("touch {{db_conf_path}}");
} }
if (test("[ -f {{db_conf_path}} ]")) { if (test("[ -f {{db_conf_path}} ]")) {
$db_host = ask('database host', 'localhost'); run('printf "[client]\nhost=\"'.ask('database host', 'localhost').'\"\nport=\"'.ask('database port', '3306').'\"\nuser=\"'.ask('database user').'\"\npassword=\"'.askHiddenResponse('database password').'\"\n\n[mysql]\ndatabase=\"'.ask('database name').'\"" > {{db_conf_path}}');
$db_port = ask('database port', '3306');
$db_name = ask('database name');
$db_user = ask('database user');
$db_pass = askHiddenResponse('database password');
run('printf "[client]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\nhost='.$db_host.'\nport='.$db_port.'\n\n[mysql]\ndatabase=\"'.$db_name.'\"" > {{db_conf_path}}');
info('config successful created'); info('config successful created');
} else { } else {
throw new \RuntimeException('can not create {{db_conf_path}}, task stopped'); throw new \RuntimeException('can not create {{db_conf_path}}, task stopped');