Skip to content

Instantly share code, notes, and snippets.

@notomato
Created March 21, 2013 04:15
Show Gist options
  • Save notomato/5210642 to your computer and use it in GitHub Desktop.
Save notomato/5210642 to your computer and use it in GitHub Desktop.
Configuring environment in a legacy app with Lithium.
use lithium\core\Environment;
$request = new lithium\action\Request();
Environment::is(function($request) {
switch (true) {
case (in_array($request->env('SERVER_ADDR'), array('::1', '127.0.0.1'))):
return 'development';
case ($request->env('HTTP_HOST') == 'foobar.com.au'):
return 'staging';
case (preg_match('/^test/', $request->env('HTTP_HOST'))):
return 'test';
default:
return 'production';
}
});
Environment::set($request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment