Search code examples
google-cloud-run

Cloud Build inline yaml - escape character in variable name


My Spring app requires a variable named spring.cloud.gcp.sql.database-name to be set.

For other variables I have been able to use '--set-env-vars' and replace periods with underscores and all caps (e.g. for my.variable '--set-env-vars' _MY_VARIABLE=foo) but for hyphenated variable names this is failing.

How do I escape the hyphen in the variable name? (I'm doing this within the "Edit inline configuration" part)

I've tried DATABASE\-NAME but this didn't work


Solution

  • As stated in Binding From Environment Variables

    To convert a property name in the canonical-form to an environment variable name you can follow these rules:

    • Replace dots (.) with underscores (_).

    • Remove any dashes (-).

    • Convert to uppercase.

    For example, the configuration property spring.main.log-startup-info would be an environment variable named SPRING_MAIN_LOGSTARTUPINFO.

    Also have a look at this link