when code is run from cli apache_getenv does not work, but it usually means it is dev env

This commit is contained in:
Guillermo Dev
2018-10-21 17:58:45 +02:00
parent be0895e91e
commit 7deff8ec61

View File

@@ -71,7 +71,7 @@ class Configuration {
public static function getConfigFilePath() public static function getConfigFilePath()
{ {
if (null === self::$customConfigFilePath) { if (null === self::$customConfigFilePath) {
$envfile = apache_getenv('APPLICATION_ENV') === 'development' ? 'local' : 'global'; $envfile = (php_sapi_name() === 'cli' || apache_getenv('APPLICATION_ENV') === 'development') ? 'local' : 'global';
self::$customConfigFilePath = realpath(dirname(__FILE__) . "/../../../../../../config/configuration.$envfile.php"); self::$customConfigFilePath = realpath(dirname(__FILE__) . "/../../../../../../config/configuration.$envfile.php");
} }
return self::$customConfigFilePath; return self::$customConfigFilePath;