-
Notifications
You must be signed in to change notification settings - Fork 297
Closed
Labels
Milestone
Description
Is there a way to set certain config option using environment variables? There are cases when it can be handy to pass some environment variables instead of making changes to the config files such as:
- In testing or development environments we want to run the instance with different configs frequently.
- In production environments if we want to run multiple instances on different hosts/ports and load balance then we will have to duplicate config files with very little differences.
- When the application is deployed for the first time using
.warfile, there is no way to overwrite the defaults unless the config files are modified and the and the application is reloaded by restarting Tomcat.
Here is an example of some configs from the wayback.xml file:
wayback.basedir=/tmp/openwayback
wayback.url.scheme=http
wayback.url.host=localhost
wayback.url.port=8080I understand that XML files cannot load environment variables, but when these config options are loaded in Java files, at that time respective environment variables can take precedence if present otherwise fallback to the values set in the config files. Here is a pseudo example to illustrate the usage:
wayback.url.port = env["wayback-url-port"] || conf["wayback.url.port"] || 8080I was deploying Wayback suing Docker Container and I wished this functionality was there.