项目初始化
This commit is contained in:
38
config/database.php
Normal file
38
config/database.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user