I want to define "my_instance_name" once and re-use it in my app.yaml and index.php
My initial thought was to create an env_variable, but could not find a way to use it: env_variables: CLOUD_SQL_INSTANCE_MAIN: "my_instance_name" beta_settings: cloud_sql_instances: ?CLOUD_SQL_INSTANCE_MAIN?
Then I looked up how to define and reuse variables in yaml files via define: define: &background_color '#998088' fill-color: *background_color
But when I deployed my app, I got a parsing error that said 'Anchors not supported in this handler'
Not sure what the right way to approach this is.
Here's an example of the app.yaml I tried:
runtime: php
env: flex
runtime_config:
document_root: .
# dsd want to be able to create an env_var for this because
# this instance name is used here and in index.php
#env_variables:
# CLOUD_SQL_INSTANCE_MAIN: "my_unique_id:us-central1:main-instance"
beta_settings:
cloud_sql_instances: "my_unique_id:us-central1:main-instance"
Change your
app.yamlas below:Reference: Introducing YAML anchors