Skip to content

Instantly share code, notes, and snippets.

@ddonovan
Created May 19, 2014 01:43
Show Gist options
  • Save ddonovan/ac3c45419517b657e13d to your computer and use it in GitHub Desktop.
Save ddonovan/ac3c45419517b657e13d to your computer and use it in GitHub Desktop.
Environment detection for larval app.
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.
|
*/
/*
Rename LARAVEL_ENV to whatever name works for you.
*/
$env = $app->detectEnvironment(function()
{
return getenv('LARAVEL_ENV') ? : 'local';
});
// add this somewhere on your server configuration and reboot apache. I think you can add it in a few different places, I used the vhosts file.
<VirtualHost *:80>
SetEnv LARAVEL_ENV "production"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment