38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
$env = function (string $dotKey, $default = null) {
|
|
$upperKey = strtoupper(str_replace('.', '_', $dotKey));
|
|
$value = env($dotKey, null);
|
|
if ($value === null) {
|
|
$value = env($upperKey, $default);
|
|
}
|
|
return $value ?? $default;
|
|
};
|
|
|
|
return [
|
|
'default' => 'mysql',
|
|
'connections' => [
|
|
'mysql' => [
|
|
'driver' => 'mysql',
|
|
'host' => $env('database.hostname', '127.0.0.1'),
|
|
'port' => $env('database.hostport', '3306'),
|
|
'database' => $env('database.database', 'dafuweng-buildadmin'),
|
|
'username' => $env('database.username', 'dafuweng-buildadmin'),
|
|
'password' => $env('database.password', '123456'),
|
|
'charset' => 'utf8mb4',
|
|
'collation' => 'utf8mb4_general_ci',
|
|
'prefix' => '',
|
|
'strict' => true,
|
|
'engine' => null,
|
|
'options' => [
|
|
PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
|
|
],
|
|
'pool' => [
|
|
'max_connections' => 5,
|
|
'min_connections' => 1,
|
|
'wait_timeout' => 3,
|
|
'idle_timeout' => 60,
|
|
'heartbeat_interval' => 50,
|
|
],
|
|
],
|
|
],
|
|
]; |