feat: config

This commit is contained in:
2024-10-26 16:26:10 +08:00
parent 5063f2f002
commit d15c03c04e
5 changed files with 90 additions and 0 deletions

30
config/autoload/ali.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use function Hyperf\Support\env;
return [
// 阿里云 accessKeyId
'access_key_id' => env('ALI_ACCESS_KEY_ID', ''),
// 阿里云 accessKeySecret
'access_key_secret' => env('ALI_ACCESS_KEY_SECRET', ''),
// 阿里云 oss bucket
'bucket' => env('ALI_BUCKET', ''),
// 阿里云 oss region
'region' => env('ALI_REGION', 'cn-shenzhen'),
// 阿里云 oss 临时上传目录
'upload_dir' => env('ALI_UPLOAD_DIR', ''),
// 阿里云 oss 回调地址
'callback_url' => env('ALI_CALLBACK_URL', ''),
// 阿里云 oss 外网访问地址
'oss_url' => env('ALI_OSS_URL', ''),
];

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use function Hyperf\Support\env;
return [
//是否开启定时任务
'enable' => env('CRONTAB_ENABLE', false),
];

View File

@@ -9,6 +9,8 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\ModelCache\Handler\RedisHandler;
use function Hyperf\Support\env;
return [
@@ -37,5 +39,14 @@ return [
'inheritance' => 'Model',
],
],
'cache' => [
'handler' => RedisHandler::class,
'cache_key' => 'mc:%s:m:%s:%s:%s',
'prefix' => 'default',
'ttl' => 3600 * 24,
'empty_model_ttl' => 3600,
'load_script' => true,
'use_default_value' => false,
]
],
];

View File

@@ -26,4 +26,32 @@ return [
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],
'system' => [
'host' => env('REDIS_HOST', 'localhost'),
'auth' => env('REDIS_AUTH', null),
'port' => (int) env('REDIS_PORT', 6379),
'db' => (int) env('SYSTEM_REDIS_DB', 1),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],
'lock' => [
'host' => env('REDIS_HOST', 'localhost'),
'auth' => env('REDIS_AUTH', null),
'port' => (int) env('REDIS_PORT', 6379),
'db' => (int) env('LOCK_REDIS_DB', 2),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],
];