Tundra includes a package configuration service tundra.configuration:get which returns the configuration settings associated with the given package.
This service supports the tiering of configuration settings across a package-specific file and a server-specific file, where both files are merged with the server-specific file taking precedence. This approach allows for settings which are not environment-specific or for default settings to be stored within the package itself, and for other environment-specific settings or overridden settings to be stored in a configuration file specific to an Integration Server instance. Note that if this is not required, a single file can still be used.
Package-specific settings are loaded from the following file:
./packages//config/package.
Server-specific settings are loaded from the following file:
./config/packages/.
Where is the name of the package in question, and is one of the following supported file extensions:
-
hjson - Hjson formatted file
-
json - JSON formatted file
-
properties - Java properties formatted file
-
values - IData or Values encoded file
-
xml - Arbitrary XML or IData or Values encoded file
-
yaml - YAML formatted file
Package configurations are cached lazily in memory: read first from disk on the initial invocation, and then returned from an in-memory cache thereafter.
Prior to a configuration being cached in memory, variable substitution %key% substrings found in configuration values are automatically substituted as follows:
This approach allows for server-specific global configuration values stored as environment variables, java system properties, or global variables to be included in the returned package configurations. Note that because the variable substitution occurs when the configuration is first read from disk and cached (to optimise performance), changes to environment variables, java system properties, or global variables will not be reflected in the returned package configurations until those configurations are refreshed from disk.
Inputs:
$package is the optional name of the package whose configuration is to be returned. If not specified, the package is automatically inferred from the invoking service.
$refresh? is an optional boolean which when true will force a refresh of the cached configuration from disk. Defaults to false.
Outputs:
$package is the name of the package whose configuration was returned.
$configuration is an IData document containing the configuration settings for the given package.
Refer to ConfigurationManager.java for the underlying Java implementation, if you are interested.