feat(hyperf3): 将配置文件等的 env 方法迁移到 hyperf/support/env

Closes #7

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
This commit is contained in:
李东云
2023-10-13 15:58:22 +08:00
parent cfb189a6cf
commit 269d24b305
8 changed files with 18 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ use Hyperf\Database\Commands\Ast\ModelRewriteSoftDeletesVisitor;
use Hyperf\Database\Commands\Ast\ModelRewriteTimestampsVisitor; use Hyperf\Database\Commands\Ast\ModelRewriteTimestampsVisitor;
use Hyperf\Database\Commands\ModelOption; use Hyperf\Database\Commands\ModelOption;
use function Hyperf\Support\env;
return [ return [
'default' => [ 'default' => [
'driver' => env('DB_DRIVER', 'mysql'), 'driver' => env('DB_DRIVER', 'mysql'),

3
installer/resources/amqp/amqp.php Executable file → Normal file
View File

@@ -9,6 +9,9 @@ declare(strict_types=1);
* @contact group@hyperf.io * @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/ */
use function Hyperf\Support\env;
return [ return [
'default' => [ 'default' => [
'host' => env('AMQP_HOST', 'localhost'), 'host' => env('AMQP_HOST', 'localhost'),

View File

@@ -10,6 +10,7 @@ declare(strict_types=1);
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/ */
use Hyperf\ConfigCenter\Mode; use Hyperf\ConfigCenter\Mode;
use function Hyperf\Support\env;
return [ return [
'enable' => (bool) env('CONFIG_CENTER_ENABLE', true), 'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),

View File

@@ -12,6 +12,8 @@ declare(strict_types=1);
use Hyperf\ConfigApollo\PullMode; use Hyperf\ConfigApollo\PullMode;
use Hyperf\ConfigCenter\Mode; use Hyperf\ConfigCenter\Mode;
use function Hyperf\Support\env;
return [ return [
'enable' => (bool) env('CONFIG_CENTER_ENABLE', true), 'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
'driver' => env('CONFIG_CENTER_DRIVER', 'apollo'), 'driver' => env('CONFIG_CENTER_DRIVER', 'apollo'),

4
installer/resources/config_center/config_etcd.php Executable file → Normal file
View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
*/ */
use Hyperf\ConfigCenter\Mode; use Hyperf\ConfigCenter\Mode;
use function Hyperf\Support\env;
return [ return [
'enable' => (bool) env('CONFIG_CENTER_ENABLE', true), 'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
'driver' => env('CONFIG_CENTER_DRIVER', 'etcd'), 'driver' => env('CONFIG_CENTER_DRIVER', 'etcd'),
@@ -18,7 +20,7 @@ return [
'drivers' => [ 'drivers' => [
'etcd' => [ 'etcd' => [
'driver' => Hyperf\ConfigEtcd\EtcdDriver::class, 'driver' => Hyperf\ConfigEtcd\EtcdDriver::class,
'packer' => Hyperf\Utils\Packer\JsonPacker::class, 'packer' => Hyperf\Codec\Packer\JsonPacker::class,
'namespaces' => [ 'namespaces' => [
'/application', '/application',
], ],

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
*/ */
use Hyperf\ConfigCenter\Mode; use Hyperf\ConfigCenter\Mode;
use function Hyperf\Support\env;
return [ return [
'enable' => (bool) env('CONFIG_CENTER_ENABLE', true), 'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
'driver' => env('CONFIG_CENTER_DRIVER', 'nacos'), 'driver' => env('CONFIG_CENTER_DRIVER', 'nacos'),

View File

@@ -9,6 +9,9 @@ declare(strict_types=1);
* @contact group@hyperf.io * @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/ */
use function Hyperf\Support\env;
return [ return [
'default' => [ 'default' => [
'driver' => env('DB_DRIVER', 'mysql'), 'driver' => env('DB_DRIVER', 'mysql'),

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
*/ */
use Zipkin\Samplers\BinarySampler; use Zipkin\Samplers\BinarySampler;
use function Hyperf\Support\env;
return [ return [
'default' => env('TRACER_DRIVER', 'zipkin'), 'default' => env('TRACER_DRIVER', 'zipkin'),
'enable' => [ 'enable' => [