I wrote the
App::Env framework to handle situations like this. It's quite a bit more work to set up than BrowserUK's solution (which is short and to the point), but if you find yourself needing to do a lot of switching between environments, it's worth a look.