Managing Complicated Configuration Files

Having a single, monolithic configuration file for AMPS is great for simple environments, but as an instance grows to include multiple teams or applications it's often desirable to partition the config into individual components with different maintainers.

For example, let's say you have two teams, 'a' and 'b', that want to maintain their own SOW topics. You could have a single configuration file, but one team could easily alter the other's topic configuration in undesirable ways (accidents happen!) Ideally, you'd have a team-a-topics.xml and a team-b-topics.xml that could be maintained by their respective teams and included into the larger configuration file.

You can then control which file is used based on environment or command-line variable to AMPS.

In the configuration file, you would specify an inclusion block like the following:

<Include file="/amps/team-configs/${TEAM}-topics.xml"/>

When starting AMPS, you can either set the environment as follows:

$ TEAM=team-a /path/to/amps/bin/ampServer config.xml

or pass the value explicitly on the command line:

$ /path/to/amps/bin/ampServer -DTEAM=team-a config.xml

When AMPS starts, it replaces ${TEAM} with the value provided, and loads the correct file.

This mechanism can also be used in cases where a given environment doesn't need the functionality that would be otherwise included. In that case, you create an empty file with a descriptive name (in this case, something like team-none.xml would be appropriate), and then pass that value when you start AMPS.

$ /path/to/amps/bin/ampServer -DTEAM=team-none config.xml

AMPS interprets an empty file as a valid (but empty) inclusion.

Last updated