As for the official documentation ( https://cloud.google.com/appengine/docs/standard/java/config/appref ), a Java application using App Engine Standard for Java 8 runtime should describe it's env in an appengine-web.xml
located under WEB-INF
folder.
The chances are high those variables vary from env to env, and I refuse to build env dedicated artifacts.
Can I set those env vars in an external file? If yes how?
In order to set Env Variables for App Engine in Java runtime, you can also set them in the app.yaml file using the env_variables key
for example:
env_variables:
MY_VAR_COLOR: 'blue'
You can see the recommended documentation in here
You can't include external file for environment variables definition.
For this, I duplicate the appengine-web.xml
and I store it in separate subfolders WEB-INF/dev/
, WEB-INF/uat/
, WEB-INF/prod/
Then, I use Maven to copy the appengine-web.xml
from the right subfolder according with the profile passed to the build -P
param
Not very maintainable because you have to replicate the modification in all the appengine-web.xml
files, but I don't find a better trade off for having separate value per environment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.