Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I'm using Focus Labs Config and trying to give the is_system_on setting the same treatment as the debugging preference.

So far, in config.master.php I have added;

$env_config['is_system_on']         = (ENV_SYSTEM_ON) ? 'y' : 'n' ;

Then within config.env.php, in the appropriate CASE I have (for example);

case 'staging.domain.com' :
    define('ENV', 'stage');
    define('ENV_FULL', 'Staging');
    define('ENV_DEBUG', FALSE);
    define('ENV_SYSTEM_ON', FALSE);
break;

However the system on/off setting in config.env.php seems to be ignored and the only way to turn the site on or off is to do so within the CP.

Everything else is working perfectly across local, dev, staging and production servers with different settings being used for each. It's just this extra one I can't get to work.

Does anyone have any idea why this may be and how I could overcome it so I could set the on/off status within my environment cases?

share|improve this question
    
What version of EE is this on? –  Natetronn Apr 24 at 1:22

3 Answers 3

Not sure why that's not working but I tend to just override the default value of 'is_system_on' in the specific environment's config. E.g. for your staging environment add this to config.stage.php:

$env_config['is_system_on'] = 'n';
share|improve this answer
    
It seems to work on my local build but not on any remote server. I was wondering if the setting is encrypted in the site settings hash in the database and can't be over-ridden - much like the site_name used to be (maybe still is!) –  foamcow Apr 23 at 15:55
    
I'll give that method a go actually. But the logic of what I've done using the ternary conditional is correct isn't it? –  foamcow Apr 23 at 15:56
    
Haven't tried this yet but I'm guessing it's going to work. My hunch is that when the env_config and config arrays are combined the latter over-rides the former... where that's coming from though who knows! –  foamcow Apr 24 at 10:56

Forgive me if this is patronising, but are you sure you're not logged in as a superadmin? If so, this setting won't apply to you and you'll be able to see the site even when it's switched off.

share|improve this answer
    
No problem. Nope. Not logged in at all. I've tested it logged in and logged out. –  foamcow Apr 23 at 15:54
    
I was thinking this as well based on what the docs say here - "Makes system only available to Super Admins" –  Natetronn Apr 23 at 17:01
    
That's precisely how it does work, and how I want it to work. I don't want the staging or dev sites to show up to anyone except site admins. To make this easier I want to set the on/off status within eacg environment's configuration. –  foamcow Apr 23 at 21:06

I also don't want to be patronizing but, you said you "added" the new config override though, EE Master Config already includes it here - is there a chance you are adding the config override twice? I'm assuming you meant to say you "updated" the current config override accordingly vs adding it twice.

share|improve this answer
    
I wasn't clear. I changed that line to use the value I set in config.env.php. Basically I want to be able to switch the site on or off (for non admins) based on its environment. –  foamcow Apr 23 at 21:04
    
We're trying to rule out ALL possible causes. I'm checking the EL bug log but, not seeing much there either. Maybe do a full project search for is_system_on to see if the config override exists elsewhere in the project? –  Natetronn Apr 24 at 1:06
    
I have a hunch that when the env_config and config arrays are merged the config array is done latterly effectively over-riding my env_config setting. Not sure where the other value is coming from though. –  foamcow Apr 24 at 10:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.