OSGI Configuration: nt:file or sling:OsgiConfig

Avatar

Avatar

AEMWizard

Avatar

AEMWizard

AEMWizard

11-03-2020

I've seen OSGI configurations use as nt:file or sling:OsgiConfig interchangeably. What the best practice? Why is nt:files used? Are. there any other variations?

Why does core components. follow the nt:file pattern, /apps/core/wcm/config.author/com.day.cq.wcm.foundation.forms.impl.FormParagraphPostProcessor-core-components.config?

Why does we-retail follow the sling:OsgiConfig pattern, /apps/weretail/config/org.apache.sling.commons.log.LogManager.factory.config-we-retail?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

910

Correct Answer

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

910

Correct Answer

1.0K
Jörg_Hoh
Employee

13-03-2020

There are now a few ways how you can configure OSGI configurations via the repository: Using sling:osgiConfig nodes, using an nt:file with the properties (in a ini-style format), and there is/will be a JSON variant ...

 

In the end it doesn't matter which one to use; when you are going to edit it in the IDE and store it in GIT, dropping a file is probably the easiest because you don't have the overhead of XML (as you have in the case of using sling:osgiConfig). Storing it as JSON is part of the latest AEM versions, so not yet widespread, thus I wouldn't recommend it today for general use.

 

regards

Jörg

Answers (2)

Answers (2)

Avatar

Avatar

jbrar

Employee

Avatar

jbrar

Employee

jbrar
Employee

16-03-2020

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

12-03-2020

If you are creating repository based config then use sling:OsgiConfig

If you want to manage configurations using web console then you can use nt:file.

 

As soon as you update sling:OsgiConfig type config from web console, it converts into nt:file.