From ce1d5884c336c51b64ea4ca64a4282b01fc20a7d Mon Sep 17 00:00:00 2001 From: Exodus4D Date: Sat, 14 Jan 2017 17:48:15 +0100 Subject: [PATCH] - CACHE backend can be set by ENV Variable (optional), #175, #420 --- app/config.ini | 2 +- app/main/lib/config.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/config.ini b/app/config.ini index 200921f3..3904003a 100644 --- a/app/config.ini +++ b/app/config.ini @@ -19,7 +19,7 @@ TZ = UTC ; Cache backend. Can handle Redis, Memcache module, APC, WinCache, XCache and a filesystem-based cache. ; (default: folder=tmp/cache/) CACHE = folder=tmp/cache/ -;CACHE = redis=localhost:6379 +;CACHE = redis=localhost:6379 ; Callback functions ============================================================================== ONERROR = Controller\Controller->showError diff --git a/app/main/lib/config.php b/app/main/lib/config.php index dc95bcc9..1f32d284 100644 --- a/app/main/lib/config.php +++ b/app/main/lib/config.php @@ -51,16 +51,20 @@ class Config extends \Prefab { } /** - * set some global framework variables + * set/overwrite some global framework variables original set in config.ini + * -> can be overwritten in environments.ini OR ENV-Vars + * -> see: https://github.com/exodus4d/pathfinder/issues/175 * that depend on environment settings */ protected function setHiveVariables(){ $f3 = \Base::instance(); + // hive keys that can be overwritten + $hiveKeys = ['BASE', 'URL', 'DEBUG', 'CACHE']; - // hive keys that should be overwritten by environment config - $hiveKeys = ['BASE', 'URL', 'DEBUG']; foreach($hiveKeys as $key){ - $f3->set($key, self::getEnvironmentData($key)); + if( !is_null( $var = self::getEnvironmentData($key)) ){ + $f3->set($key,$var); + } } }