Replaced localhost name by 127.0.0.1 for databases when in travis

This commit is contained in:
Alejandro Celaya 2019-03-05 20:58:48 +01:00
parent 840e377245
commit a22beeed08
2 changed files with 4 additions and 4 deletions

View File

@ -26,9 +26,9 @@ install:
before_script:
- mysql -e 'CREATE DATABASE shlink_test;'
- psql -c 'create database shlink_test;' -U postgres
- mkdir build
script:
- mkdir build
- composer ci
after_success:

View File

@ -17,7 +17,7 @@ $swooleTestingPort = 9999;
$buildDbConnection = function () {
$driver = env('DB_DRIVER', 'sqlite');
$isCi = env('TRAVIS') === 'true';
$isCi = env('TRAVIS', false);
switch ($driver) {
case 'sqlite':
@ -28,7 +28,7 @@ $buildDbConnection = function () {
case 'mysql':
return [
'driver' => 'pdo_mysql',
'host' => $isCi ? 'localhost' : 'shlink_db',
'host' => $isCi ? '127.0.0.1' : 'shlink_db',
'user' => 'root',
'password' => $isCi ? '' : 'root',
'dbname' => 'shlink_test',
@ -40,7 +40,7 @@ $buildDbConnection = function () {
case 'postgres':
return [
'driver' => 'pdo_pgsql',
'host' => $isCi ? 'localhost' : 'shlink_db_postgres',
'host' => $isCi ? '127.0.0.1' : 'shlink_db_postgres',
'user' => 'postgres',
'password' => $isCi ? '' : 'root',
'dbname' => 'shlink_test',