closes #175 added alternative environment configuration

This commit is contained in:
Exodus4D
2016-05-30 20:17:54 +02:00
parent a8bc61b7a7
commit 1e02027282
10 changed files with 275 additions and 56 deletions

View File

@@ -9,6 +9,7 @@
namespace Controller;
use Controller\Api as Api;
use Controller\Ccp\Sso as Sso;
use lib\Config;
use Model;
use DB;
@@ -760,33 +761,7 @@ class Controller {
* @return string|null
*/
static function getEnvironmentData($key){
$f3 = \Base::instance();
$environment = self::getEnvironment();
$environmentKey = 'ENVIRONMENT[' . $environment . '][' . $key . ']';
$data = null;
if( $f3->exists($environmentKey) ){
$data = $f3->get($environmentKey);
}
return $data;
}
/**
* get current server environment status
* -> "DEVELOP" or "PRODUCTION"
* @return string
*/
static function getEnvironment(){
$f3 = \Base::instance();
return $f3->get('ENVIRONMENT.SERVER');
}
/**
* check if current server is "PRODUCTION"
* @return bool
*/
static function isProduction(){
return self::getEnvironment() == 'PRODUCTION';
return Config::getEnvironmentData($key);
}
/**