mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 15:13:59 -06:00
Added option to customize database hostname and port
This commit is contained in:
parent
29fd313337
commit
869865f22a
@ -135,11 +135,18 @@ class InstallCommand extends Command
|
||||
$params['NAME'] = $this->ask('Database name', 'shlink');
|
||||
$params['USER'] = $this->ask('Database username');
|
||||
$params['PASSWORD'] = $this->ask('Database password');
|
||||
$params['HOST'] = $this->ask('Database host', 'localhost');
|
||||
$params['PORT'] = $this->ask('Database port', $this->getDefaultDbPort($params['DRIVER']));
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
protected function getDefaultDbPort($driver)
|
||||
{
|
||||
return $driver === 'pdo_mysql' ? '3306' : '5432';
|
||||
}
|
||||
|
||||
protected function askUrlShortener()
|
||||
{
|
||||
$this->printTitle('URL SHORTENER');
|
||||
@ -272,6 +279,8 @@ class InstallCommand extends Command
|
||||
$config['entity_manager']['connection']['user'] = $params['DATABASE']['USER'];
|
||||
$config['entity_manager']['connection']['password'] = $params['DATABASE']['PASSWORD'];
|
||||
$config['entity_manager']['connection']['dbname'] = $params['DATABASE']['NAME'];
|
||||
$config['entity_manager']['connection']['host'] = $params['DATABASE']['HOST'];
|
||||
$config['entity_manager']['connection']['port'] = $params['DATABASE']['PORT'];
|
||||
|
||||
if ($params['DATABASE']['DRIVER'] === 'pdo_mysql') {
|
||||
$config['entity_manager']['connection']['driverOptions'] = [
|
||||
|
@ -53,6 +53,8 @@ class InstallCommandTest extends TestCase
|
||||
shlink_db
|
||||
alejandro
|
||||
1234
|
||||
|
||||
|
||||
0
|
||||
doma.in
|
||||
abc123BCA
|
||||
@ -81,6 +83,8 @@ CLI_INPUT
|
||||
'dbname' => 'shlink_db',
|
||||
'user' => 'alejandro',
|
||||
'password' => '1234',
|
||||
'host' => 'localhost',
|
||||
'port' => '3306',
|
||||
'driverOptions' => [
|
||||
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user