<message-filter>
<messages>
<message>Hello {$ NAME $}!</message> (1)
{$ EXTRA_MESSAGES $} (2)
</messages>
</message-filter>
After installing Repose, config files can be found in /etc/repose
.
At a minimum, Repose needs a container.cfg.xml
and system-model.cfg.xml
to start.
The container.cfg.xml
config file tells Repose where to find component artifacts and where to deploy them while running.
See Container for more details.
The main config file is system-model.cfg.xml
.
This file configures the list of filters, the deployment layout, and the location of the origin service.
Out of the box, Repose is setup to run as a single node listening on port 8080, to run with no filters and services enabled, and to point to rackspace.com on port 80 as the origin service.
See System Model for more details.
Repose reads the config files when it starts up and when a file gets updated. The configuration files are checked for updates every 15 seconds. This is not configurable nor can it be manually triggered.
When the config files are invalid, Repose will continue using the previous known good configuration, or if Repose was just initially starting up, then it will return a 503 until the config files are fixed.
To make configuration files more portable, environment variable substitution is supported. With this feature, configuration files become semi-dynamic — the same configuration files can be used to define differing behavior dependent on the environment Repose is running in.
Substituting an environment variable into a configuration file is easy! Wherever you want the value of an environment variable in your configuration file, simply surround the name of the environment variable with output delimiters.
<message-filter>
<messages>
<message>Hello {$ NAME $}!</message> (1)
{$ EXTRA_MESSAGES $} (2)
</messages>
</message-filter>
1 | The NAME environment variable will be substituted into this text node.
If NAME is set to World , then this line will be rendered as <message>Hello World!</message> . |
2 | The EXTRA_MESSAGES environment variable will be substituted within the messages element.
If EXTRA_MESSAGES is set to <message>You’ve got mail!</message> , that line would be included in the configuration file. |
Under the hood, the JTwig templating engine is used. However, Repose does not use all of the JTwig default delimiters. The following table shows the differences.
Apart from delimiters, the Repose template syntax matches the JTwig syntax. In addition to simple substitution, JTwig provides a number of other well-documented features. |
When substituting an environment variable, Repose strictly requires that the named environment variable exists. If not, Repose will throw an exception when processing the containing configuration file. |
Updating an environment variable will not cause Repose to reload any configuration which references that environment variable. |