4

I am deploying a SpringBoot application to GAE and want to set some system properties to be used in my application.yml file. Other cloud providers like Azure or Heroku allow me to define system properties for each application but I can't find out how to do this in GAE. I don't want the values in source control since they contain passwords.

What I want to do specifically:

  • Add a system property MONGODB_URI somewhere on GAE
  • Reference it in application.yml like so: MONGODB_URI: ${MONGODB_URI}

This seems like a pretty standard use case to me but I can't find anything (satisfying) about it. These questions regard the same matter:

I understand I can create entities and access them through an api in the code. But it bothers me that I need to make code changes for a simple use case like this, and it should be possible to pass some secret environment properties to the container.

enp4yne
  • 638
  • 5
  • 21

1 Answers1

0

You can set environment variables to the Java 8 App Engine standard environment by addind them in the appengine-web.xml.

<env-variables>
  <env-var name="MONGODB_URI" value="MONGODB_URI_VALUE" />
</env-variables>

EDIT:

If you don't want have your keys harcoded in your source code nor in your App Engine config files, the recommended approach is to store secrets in Google Cloud Platform using Cloud Key Management Service and Cloud Storage.

llompalles
  • 3,072
  • 11
  • 20
  • should have made this clearer in my question, but the point is I don't want to have the value in source control (thus "secret" environment variables) – enp4yne Mar 07 '19 at 12:42
  • Thanks for the clarification, I have updated my answer. – llompalles Mar 07 '19 at 13:03