mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Add support for DSN
This commit is contained in:
@@ -69,6 +69,8 @@ DB_PORT=3306
|
|||||||
DB_DATABASE=firefly
|
DB_DATABASE=firefly
|
||||||
DB_USERNAME=firefly
|
DB_USERNAME=firefly
|
||||||
DB_PASSWORD=secret_firefly_password
|
DB_PASSWORD=secret_firefly_password
|
||||||
|
# leave empty or omit when not using a socket connection
|
||||||
|
DB_SOCKET=
|
||||||
|
|
||||||
# MySQL supports SSL. You can configure it here.
|
# MySQL supports SSL. You can configure it here.
|
||||||
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
||||||
|
@@ -63,6 +63,12 @@ class CreateDatabase extends Command
|
|||||||
$exists = false;
|
$exists = false;
|
||||||
$checked = false; // checked for existence of DB?
|
$checked = false; // checked for existence of DB?
|
||||||
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
|
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
|
||||||
|
|
||||||
|
if ('' !== env('DB_SOCKET', '')) {
|
||||||
|
$dsn = sprintf('mysql:unix_socket=%s;charset=utf8mb4', env('DB_SOCKET', ''));
|
||||||
|
}
|
||||||
|
$this->info(sprintf('DSN is %s', $dsn));
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
|
Reference in New Issue
Block a user