From a56c4cd47f07edd2bf78d2a0a762dfd20692032e Mon Sep 17 00:00:00 2001 From: Brandon Morse Date: Thu, 6 Apr 2017 17:35:50 -0400 Subject: [PATCH] #1 - Updated logic on the application environment check --- index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index c27a78e..ecfbdda 100755 --- a/index.php +++ b/index.php @@ -53,7 +53,14 @@ * * NOTE: If you change these, also change the error_reporting() code below */ - define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); +if( (strpos($_SERVER['HTTP_HOST'], 'localhost') !== FALSE) || + (strpos($_SERVER['HTTP_HOST'], '127.0.0.1') !== FALSE) ) { // development + define('ENVIRONMENT', 'development'); +} elseif ( strpos($_SERVER['HTTP_HOST'], 'stage') !== FALSE) { // staging + define('ENVIRONMENT', 'staging'); +} else { // production + define('ENVIRONMENT', 'production'); +} /* *---------------------------------------------------------------