I'm deploying an app through gcloud on App Engine. There is an env.yaml file that I need to modify, then I upload it in a bucket, the file contains the settings and secrets:
env_variables:
DB_URL: XXX
URL: YYY
JSON_SETTINGS: '{"api": {"secret":"mySecret"}}'
There are hundred of settings in JSON_SETTINGS, and for the deployment to work I have to send it on one line. But it's not handy.
When I use a formatter to expand the JSON, I got an error :
googlecloudsdk.api_lib.app.yaml_parsing.YamlParseError: An error occurred while parsing file
Do you have any idea how to handle it?
I'm not sure I understand the problem.
Your YAML should be good.
By quoting the JSON_SETTINGS
, the JSON is treated as the value. Why must it be a single line? Why are you using a JSON formatter on YAML?
Couple of things:
You can use a block delimiter in YAML. A paragraph (|
). As in JSON_SETTINGS: |
and then the JSON content indented (!) and starting on the line be below. You can then layout over multiple lines.
You can also use "\"x\": \"something\""
to escape too.