Accessory

Developer
Supported

Environment

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Trevor Davis

     

You must be logged in to post.

Setting up with FocusLab Master Config

General

Damien
Damien

Hi Trevor,

I’ve been using Environment for a while - great addon! I’ve only recently started using the FL Master Config however and noticed that the environment setup is more or less the same. I had some issues and couldnt figure out where the Environment code really belonged under this setup so I combined it on one dev site and it seems to work fine but wanted to run it past you first.

Is doing this in the FLMC config.env.php file ok and do you see any issues arising form it:

if ( ! defined('ENV'))
{
 
switch (strtolower($_SERVER['HTTP_HOST'])) {
  
case 'example.dev' :
   
define('ENV''local');
   
define('ENV_FULL''Local');
   
define('ENV_DEBUG'TRUE);
   
$config['environment_color''green';
  break;
  
  case 
'staging.example.org.au' :
   
define('ENV''stage');
   
define('ENV_FULL''Staging');
   
define('ENV_DEBUG'FALSE);
   
$config['environment_color''blue';
  break;
  
  case 
'example.dev.com' :
   
define('ENV''dev');
   
define('ENV_FULL''Development');
   
define('ENV_DEBUG'TRUE);
   
$config['environment_color''blue';
  break;

  default :
   
define('ENV''prod');
   
define('ENV_FULL''Production');
   
define('ENV_DEBUG'FALSE);
   
$config['environment_color''red';
  break;
 
}

Or, do you recommend locating the Environment code block elsewhere when using a Master Config?

Trevor Davis
# 1
Developer
Trevor Davis

We don’t use the FL Master Config, so I can’t be 100% sure, but I don’t see any reason why that would cause any problems.