This blog­post is about set­ting up the OSGi-con­fig nodes in your repos­i­to­ry, instead of doing man­u­al changes via the Felix-con­sole.

So why not via the Felix-con­sole? Well of course that is pos­si­ble, but some­one has to exe­cute those steps on the dif­fer­ent envi­ron­ments.

When the OSGi-con­fig nodes are inside a pack­age you can eas­i­ly deploy that, and the con­fig changes are applied auto­mat­i­cal­ly.

Let’s start

When I go on-site at a new cus­tomer or part­ner, then one of the first things I do is adding ?debug=layout on the publish/dispatcher envi­ron­ment.

Most of the times peo­ple are amazed with the result (ahum not :-)), this option shows you all the com­po­nents on the page.

This fea­ture can be enabled/disabled via an OSGi-con­fig set­ting, so let’s take this one to guide you through the process.

First we have a look on this con­fig­u­ra­tion via the Felix con­sole (/system/console/configMgr)

osgi-1

Please note the PID “com.day.cq.wcm.core.impl.WCMDebugFilter”, and the name of the set­ting “wcmdbgfilter.enabled”.

These items are essen­tial for the next steps.

When the check­box is unchecked then adding the para­me­ter ?debug=layout doesn’t work any­more

DON’T CHANGE ANYTHING HERE…

1. Create config-folder

Cre­ate a new fold­er “con­fig” in the /apps direc­to­ry

osgi-5

2. Create the config-node

Now cre­ate a new node “com.day.cq.wcm.core.impl.WCMDebugFilter” (the PID) of the type “sling:OsgiConfig”

osgi-3

3. Add the config-property

In this node cre­ate a new prop­er­ty “wcmdbgfilter.enabled” with the boolean val­ue false.

After adding the prop­er­ty save the changes

osgi-4

When you now return to the Felix-con­sole, refresh the page you see now that the check­box is unchecked!

osgi-2

So this is a great result, but we have now dis­abled it in author-mode. Where it should only be dis­abled in pub­lish.

What you can do now is to add the run­mode after “con­fig” in the con­fig-fold­er, to have the set­ting enabled in that run­mode.

If you now rename con­fig to config.publish, and refresh the Felix-con­sole that set­ting is enabled again (because we are in author).

If you rename the fold­er to con​fig​.author the set­ting will be dis­abled in author.

osgi-6

When you have reached this stage you can now cre­ate an export for the con­fig-set­tings and import these on oth­er CQ-instances and the set­tings will be applied with­out soneone hav­ing to go into the Felix-con­sole.

Hap­py con­figs!

@heervisscher

0 comments