Reputation: 522
For example, I stumbled upon this link https://cloud.google.com/deployment-manager/configuration/create-configuration-file which shows below in its examples (not particularly for env).
resources:
- name: {{ env['name'] }}
type: compute.v1.instance
properties:
Upvotes: 3
Views: 11679
Reputation: 3893
You can only set environment variables in app engine through the app.yaml
and they can be accessed by your application instance.
You can define environment variables in app.yaml to make them available to the app:
env_variables: MY_VAR: 'my value'
access with os.environ
import os
os.environ.get('MY_VAR', 'default value')
The app.yaml
file must be valid YAML and must follow the app.yaml syntax.
The example given isn't YAML. It's a jinja template file used to create a configuration file.
There might be simpler ways but here's a long shot: you can generate a valid app.yaml
with the right environment variables (with their values) from a script.
template.jinja
- template to generate app.yamlgenerate_app_yaml.py
- python script to generate app.yamlUpvotes: 2