Google App Engine Flexible - environment variables

2019-02-15 12:29发布

问题:

if I have my circle-ci deplying to google with e.g. 'gcloud app deploy app.yaml' is there a simple way I can pass a dev / prod variable and have it replaced in my app.yml file below ?

Sure, I could have multiple app.dev.yml, app.dev.yml files etc but theres a lot of duplication involved unless I can just override some by using some sort of base app.yml

runtime: nodejs
env: flex
service: email

env_variables:
  PUBSUB_TOPIC: dev-email-integration-email
  PUBSUB_VERIFICATION_TOKEN: <your-verification-token>

回答1:

Sadly there really isn't a good way to do this. I'd actually suggest not using app.yaml for this purpose, and instead using a json file and nconf. That's how we do it in all of our nodejs samples.

Hope this helps!