Configuration Layers and Overrides

You can manage the configuration of multiple Heretto Deploy Portal environments from a single sitemap.

Maintaining Multiple Configuration Files

Maintaining multiple config.json files in a single sitemap enables you to easily manage your development, staging, and production portal configurations.

The config.json files are included in your sitemap as environment specific <data> elements. Here is an example of a sitemap with three configuration files:

<data href="config.json" name="config-base" type="config"/>
<data href="config-stg.json" name="config-stg" rev="stg" type="config"/>
<data href="config-prod.json" name="config-prod" rev="prod" type="config"/>

The config.json specifies the base configuration and styling of your portal.

The config-prod.json and config-stg.json files specify additional configurations for your production and staging environments. Heretto Deploy Portal combines the config.json and the config-stg.json values together to create the staging portal and combines the config.json and the config-prod.json together to create the production portal.

Important: The @rev attribute value must be specified in the <data> element so the configuration files get correctly applied to the respective environments.

In other words, the base configuration file, config.json, and the development, staging, or production file work in conjunction with one another to create the total configuration for an environment.

For example, the config.json and config-dev.json together make the up the full configuration for the development environment. This configuration setup provides a nimble and powerful way to create environment-specific configurations to test and ultimately promote and deploy to production.

Layers and Overrides

Importantly, the configuration files may contain JSON objects and arrays. Objects in two or more configuration files are layered, or merged, into a single configuration object.

Arrays in two or more files, however, are overwritten when the files are combined into a full portal configuration, and the priority is given to the environment-specific configuration file. For example, in the following example we have a JSON array in the base config.json file:

"search": {
        "facets": [
            "Content_Type"
        ]
    },

If the config-stg.json file also includes an array for search facets, such as:

"search": {
        "facets": [
            "Document_Category"
        ]
    },

The value from the config-stg.json will overwrite the value in the config.json and the staging portal environment will show the search facets corresponding to Document_Category.

Layering configuration files provides you a flexible way to test multiple configurations and manage all of them in a single sitemap.