I was wondering if anyone has figured out how to have a production env.php and a development env.php. Since Deploying your app just takes whatever code is in the directory you specify and throws it into a version, I can't figure out how this is possible.
I would have to copy my production env.php file over my local one every time I wanted to deploy something.
If there is someway that I can use the Source Code on the cloud as the production code, that would be helpful. I know how to ignore an env.php file through git. I don't see a way to do this, however, which really makes no sense to me. Why have the source code on there if you can't use it in production?
There is a way.
The appcfg.py command allows to to override environment variables at deploy time.
-- update with open source tool to manage environments --
We've written a deployment tool to automatically build the deploy command with live environment variable overrides.
And we've open-sourced it today!
https://github.com/Venditan/appengine-deploy
-- update with example --
Suppose we have these environment variables defined in our app.yaml file:
env_variables:
DB_HOST: localhost
DB_USER: marty
This works great for local development.
But then, when we deploy to live, we want them to be different:
appcfg.py update app.yaml -E DB_HOST:"1.2.3.4" -E DB_USER:"emmett"
tada!