Skip to content

Commit

Permalink
环境变量读取增强 (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft authored Dec 11, 2021
1 parent 1fd3c25 commit c85516d
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions tests/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

declare(strict_types=1);

use function Imi\env;

return [
'components' => [
// 引入本组件
Expand Down Expand Up @@ -61,10 +63,10 @@
// 连接池资源配置
'resource' => [
'dbClass' => 'PdoPgsqlDriver',
'host' => imiGetEnv('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => (int) imiGetEnv('PGSQL_SERVER_PORT', 5432),
'username' => imiGetEnv('PGSQL_SERVER_USERNAME', 'root'),
'password' => imiGetEnv('PGSQL_SERVER_PASSWORD', 'root'),
'host' => env('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => env('PGSQL_SERVER_PORT', 5432),
'username' => env('PGSQL_SERVER_USERNAME', 'root'),
'password' => env('PGSQL_SERVER_PASSWORD', 'root'),
'database' => 'db_imi_test',
],
],
Expand All @@ -83,10 +85,10 @@
// 连接池资源配置
'resource' => [
'dbClass' => 'PdoPgsqlDriver',
'host' => imiGetEnv('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => (int) imiGetEnv('PGSQL_SERVER_PORT', 5432),
'username' => imiGetEnv('PGSQL_SERVER_USERNAME', 'root'),
'password' => imiGetEnv('PGSQL_SERVER_PASSWORD', 'root'),
'host' => env('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => env('PGSQL_SERVER_PORT', 5432),
'username' => env('PGSQL_SERVER_USERNAME', 'root'),
'password' => env('PGSQL_SERVER_PASSWORD', 'root'),
'database' => 'db_imi_test',
],
],
Expand All @@ -104,10 +106,10 @@
// 连接池资源配置
'resource' => [
'dbClass' => 'SwoolePgsqlDriver',
'host' => imiGetEnv('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => (int) imiGetEnv('PGSQL_SERVER_PORT', 5432),
'username' => imiGetEnv('PGSQL_SERVER_USERNAME', 'root'),
'password' => imiGetEnv('PGSQL_SERVER_PASSWORD', 'root'),
'host' => env('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => env('PGSQL_SERVER_PORT', 5432),
'username' => env('PGSQL_SERVER_USERNAME', 'root'),
'password' => env('PGSQL_SERVER_PASSWORD', 'root'),
'database' => 'db_imi_test',
],
] : [],
Expand All @@ -119,10 +121,10 @@
'connections' => [
'maindb' => [
'dbClass' => 'PdoPgsqlDriver',
'host' => imiGetEnv('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => (int) imiGetEnv('PGSQL_SERVER_PORT', 5432),
'username' => imiGetEnv('PGSQL_SERVER_USERNAME', 'root'),
'password' => imiGetEnv('PGSQL_SERVER_PASSWORD', 'root'),
'host' => env('PGSQL_SERVER_HOST', '127.0.0.1'),
'port' => env('PGSQL_SERVER_PORT', 5432),
'username' => env('PGSQL_SERVER_USERNAME', 'root'),
'password' => env('PGSQL_SERVER_PASSWORD', 'root'),
'database' => 'db_imi_test',
],
],
Expand Down

0 comments on commit c85516d

Please sign in to comment.