How to use a configuration file such as a properties file on GAE's Flex Java 8.
TL; DR
src / main / webapp / WEB-INF /
/ var / lib / jetty / webapps / root / WEB-INF /
In App Engine, the built war file etc. are archived with tar and expanded in the Docker container on the App Engine side. So you need to include the config file in the tar as well.
If you put it in WEB-INF
, it will be included in war.
So if you put config.properties
like this, it's OK.
.
└── src
└── main
├── appengine
│ └── app.yaml
├── java
│ └── ...
├── main.iml
└── webapp
└── WEB-INF
├── appengine-web.xml
├── config.properties
└── web.xml
The tar also contains Dockerfile, app.yaml, war files, etc.
In GAE Flex, tar is expanded to Docker container as mentioned above.
WEB-INF
is expanded to/ var / lib / jetty / webapps / root / WEB-INF /
.
So you can read the properties file from here.
The working directory of the app will be / var / lib / jetty
, so you can also specify it with a relative path.
Recommended Posts