forked from GithubBackups/vichan
update config and remove check for container in cache.php
This commit is contained in:
parent
0a0cf68d64
commit
240bb247f9
@ -25,20 +25,11 @@ class Cache {
|
||||
$password = $config['cache']['redis'][2] ?? '';
|
||||
$database = $config['cache']['redis'][3] ?? 1;
|
||||
|
||||
if ($config['is_docker']) {
|
||||
$host = getenv('VICHAN_REDIS_HOST') ?: $host;
|
||||
$port = getenv('VICHAN_REDIS_PORT') ?: $port;
|
||||
$password = getenv('VICHAN_REDIS_PASSWORD') ?: $password;
|
||||
$database = getenv('VICHAN_REDIS_DATABASE') ?: $database;
|
||||
}
|
||||
// $log->log("Cache info:\n"
|
||||
// . 'Cache driver: redis' . "\n"
|
||||
// . '├ Redis host: ' . $host . "\n"
|
||||
// . '├ Redis port: ' . $port . "\n"
|
||||
// . '├ Redis password: ' . str_repeat('*', strlen($password)) . "\n"
|
||||
// . '└ Redis database: ' . $database . "\n"
|
||||
// );
|
||||
|
||||
$host = getenv('VICHAN_CACHE_HOST') ?: $host;
|
||||
$port = getenv('VICHAN_CACHE_PORT') ?: $port;
|
||||
$password = getenv('VICHAN_CACHE_PASSWORD') ?: $password;
|
||||
$database = getenv('VICHAN_CACHE_DATABASE') ?: $database;
|
||||
|
||||
return new RedisCacheDriver(
|
||||
$config['cache']['prefix'],
|
||||
$host,
|
||||
|
||||
@ -137,15 +137,16 @@
|
||||
* ====================
|
||||
*/
|
||||
|
||||
$config['cache']['enabled'] = 'php';
|
||||
$config['cache']['redis'] = array(
|
||||
'host' => 'localhost',
|
||||
'port' => 6379,
|
||||
'password' => '',
|
||||
'database' => 1
|
||||
);
|
||||
|
||||
// Determine if Redis is configured via environment variables
|
||||
$redis_enabled = getenv('VICHAN_REDIS_HOST') !== false && getenv('VICHAN_REDIS_PORT') !== false;
|
||||
|
||||
// Configure cache
|
||||
if ($redis_enabled) {
|
||||
$config['cache']['enabled'] = 'redis';
|
||||
} else {
|
||||
$config['cache']['enabled'] = 'php';
|
||||
}
|
||||
getenv('VICHAN_CACHE_ENGINE') && $config['cache']['enabled'] = getenv('VICHAN_CACHE_ENGINE');
|
||||
|
||||
// Cache timeout for cached objects
|
||||
$config['cache']['timeout'] = 60 * 60 * 48; // 48 hours
|
||||
@ -1854,12 +1855,15 @@
|
||||
|
||||
/*
|
||||
* ====================
|
||||
* Docker settings
|
||||
* Container settings
|
||||
* ===================
|
||||
*/
|
||||
|
||||
$isDocker = is_file("/.dockerenv") || is_file("/run/.containerenv");
|
||||
$config['is_docker'] = $isDocker;
|
||||
$isDocker = is_file("/.dockerenv") || is_file("/run/.containerenv");
|
||||
$isKubernetes = is_file("/var/run/secrets/kubernetes.io/serviceaccount/namespace");
|
||||
$config['is_container'] = $isDocker || $isKubernetes ? true : false;
|
||||
$config['is_docker'] = $isDocker;
|
||||
$config['is_kubernetes'] = $isKubernetes;
|
||||
|
||||
/*
|
||||
* ====================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user