In Laravel 4 the default configuration environment is 'production'. This means that if you run an artisan command without the --env
option, it assumes the production configuration. This can be seen in \Illuminate\Foundation\Application::detectWebEnvironment()
which is called by detectConsoleEnvironment()
when no --env
option is set.
This behavior has become a risk with my development environment. It's really easy to forget the --env option and, say, unintentionally run a migration on your production database. (Yes, that happened but thankfully it was a minor change.) I'm close to just renaming my production environment config to 'real-production' but it seems like there should be a more elegant solution.
TL;DR
How can I change the default environment in Laravel 4 such that artisan commands do not run on production by default?