fix: 修复redis端口强制类型
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'default' => [
|
'default' => [
|
||||||
'host' => get_env('CACHE_HOSTNAME') ?? '127.0.0.1',
|
'host' => get_env('CACHE_HOSTNAME', '127.0.0.1'),
|
||||||
'password' => get_env('REDIS_PASSWORD'),
|
'password' => get_env('REDIS_PASSWORD', null),
|
||||||
'port' => get_env('CACHE_HOSTPORT') ?? 6379,
|
'port' => (int)get_env('CACHE_HOSTPORT',6379),
|
||||||
'database' => get_env('CACHE_SELECT') ?? 0,
|
'database' => get_env('CACHE_SELECT', 0),
|
||||||
'prefix' => 'redis_',
|
'prefix' => 'redis_',
|
||||||
'expire' => 0,
|
'expire' => 0,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ if (!function_exists('get_env')) {
|
|||||||
/**
|
/**
|
||||||
* Get environment variable
|
* Get environment variable
|
||||||
*/
|
*/
|
||||||
function get_env($var)
|
function get_env($var, $default = '')
|
||||||
{
|
{
|
||||||
$dir = str_replace('\\', '/', realpath(__DIR__ . '/../'));
|
$dir = str_replace('\\', '/', realpath(__DIR__ . '/../'));
|
||||||
$env_path = $dir . '/.env';
|
$env_path = $dir . '/.env';
|
||||||
@@ -148,7 +148,7 @@ if (!function_exists('get_env')) {
|
|||||||
if (is_file($env_path) && !$env_info) {
|
if (is_file($env_path) && !$env_info) {
|
||||||
$env_info = parse_ini_file($env_path, true);
|
$env_info = parse_ini_file($env_path, true);
|
||||||
}
|
}
|
||||||
return $env_info[$var] ?? '';
|
return $env_info[$var] ?? $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user