Similar to the (deprecated) Apache Sling Provisioning File Format it is possible to define a set of OSGi configurations using a CONGA template in a single JSON file which contains a set of OSGi configurations and repoinit statements, optionally mapped to run modes.

From this combined JSON file, CONGA generates individually .cfg.json files as used by Apache Sling Configuration Installer Factory. With this approach it is easy to define all configurations in one file, and add/remove configurations based on CONGA environment variables using Handlebars logic.

JSON file example

  "configurations": {
    "": {
      "prop1": "value1",
      "prop2": [1,2,3],
      "prop3": true
  "configurations:dev": {
    "my.pid2": {
      "prop1": "value-for-dev"
  "configurations:publish,prod": {
    "my.pid2": {
      "prop1": "value-for-publish-prod"
  "repoinit": [
    "create path /repoinit/test1",
    "create path /repoinit/test2"
  "repoinit:dev": [
    "create service user dev-user"

The following keys are allowed on toplevel of the JSON file:

  • configurations - Configurations that are always active
  • configurations:runmode - Configurations that are active only for the given run mode.
  • repoinit - List of repoinit statements to be always applied
  • repoinit:runmode - List of repoinit statements to be applied for the given run mode.

runmode can be a comma-separate strings, e.g. prod,publish. In this case all given run modes have to be active. On AEM as a Cloud Service, only the officially supported run modes are allowed.

You can use comments in the JSON file, they are stripped out when generating the .cfg.json files. It's also valid to use trailing commas in JSON arrays and JSON objects, this eases generating JSON via templates.

Real world example with HBS template: wcm-io-samples-aem-cms-config.osgiconfig.json.hbs

Back to top

Version: 1.4.1-SNAPSHOT. Last Published: 2024-04-15.