change made via felix console takes more precedence over apps and libs why?

1.2k Views Asked by At

Scenario: The same configuration parameter is present under /libs/*/config and /apps/*/config and modified in both locations as well as via Felix console.

And during run-time somehow Felix console configuration is taking precedence. How? My understanding is /apps should take precedence. Any views.

3

There are 3 best solutions below

2
On BEST ANSWER

You are correct. See http://docs.adobe.com/docs/en/cq/current/deploying/configuring_osgi.html#Configuration%20Details which states:

The following order of precedence is used:

  1. Repository nodes under /apps/*/config....either with type sling:OsgiConfig or property files (CHECK)
  2. Repository nodes with type sling:OsgiConfig under /libs/*/config.... (ootb defns)
  3. Any .config files from /crx-quickstart/launchpad/config/.... on the local file system.

This means that a generic configuration in /libs can be masked by a project specific configuration in /apps.

Are the config nodes run-mode specific? If a run-mode doesn't match, that could explain why the node under apps is not getting applied:

As the same configuration parameter can be located in several places, the system:

  • searches for all nodes of type sling:OsgiConfig
  • filters according to service name
  • filters according to run mode

Also mentioned in the above doc, in case the changes were made when the system is running, then the following order of precedence applies:

  • Modifying a configuration in the Web console will take immediate effect as it takes precedence at runtime.
  • Modifying a configuration in /apps will take immediate effect.
  • Modifying a configuration in /libs will take immediate effect, unless it is masked by a configuration in /apps.

This might explain why the config changes done in the OSGI console is being picked instead of the changes in your /apps.

0
On

The following order of precedence is used:

    Repository nodes under /apps/*/config....either with type sling:OsgiConfig or property files (CHECK)
    Repository nodes with type sling:OsgiConfig under /libs/*/config.... (ootb defns)
    Any .config files from /crx-quickstart/launchpad/config/.... on the local file system.

This means that a generic configuration in /libs can be masked by a project specific configuration in /apps.

In CQ5. Any changes done in felix console modifies the config files with the highest priority.

For eg under

/apps/*/config you have an "org.apache.sling.security.impl.ReferrerFilter.config" file

And you modify the Apache Sling Referrer Filter via felix console

The config file "org.apache.sling.security.impl.ReferrerFilter.config" present under /apps/*/config will be modified with the value you just entered in felix console.

0
On

Resolution order at Runtime

Configuration changes made while the system is running trigger a reload with the modified configuration.

Then the following order of precedence applies:

  1. Modifying a configuration in the Web Console will take immediate effect as it takes precedence at runtime.
  2. Modifying a configuration in /apps will make immediate effect.
  3. Modifying a configuration in /libs will take immediate effect, unless it is masked by a configuration in /apps.

Resolution order at startup

  1. Repository nodes under /apps/*/config….. either with type sling:OsgiConfig or property files

  2. Repository nodes with type sling:OsgiConfig under /libs/*/config…. (ootb)

  3. Any .config files from /crx-quickstart/launchpad/config/… on the local file system