Create and Set OSGI config variable through dialog | Community
Skip to main content
February 5, 2018
Solved

Create and Set OSGI config variable through dialog

  • February 5, 2018
  • 6 replies
  • 3450 views

Hi guys,

is it possible to set a OSGI config variable through a dialog?

For Example I want enable the authors to change an API Key, but not only to change it I want to create a variable according to the baseurl the component/service is running on.

Test.com uses one config variable which is created on startup -> com.test.apikey

Test-test.com uses another config which is created on startup -> com.test-test.apikey

Br,

Tim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Hi,

Don't use OSGI for this. Setting OSGI configs might cause internal rebindings of services, potentially causing temporary failures on requests. Also this requires sufficient privileges, and I would not want to grant an ordinary author (even he's allowed to update the API keys) these privileges.


Rather use the Sling Context Aware Configuration, which is more appropriate and gives you multitenancy for free :-)

Apache Sling :: Apache Sling Context-Aware Configuration

6 replies

Ratna_Kumar
February 5, 2018

Hi,

I think you cannot create and set OSGI config variable through dialog. Instead you can set and read it from ConfigMgr. See this below article for your reference.

Reading OSGi Configuration Values for Adobe Experience Manager 6.3

February 5, 2018

Thanks Ratna

So there is really no possibility to create them during runtime? Maybe someone knows a little bit more?

smacdonald2008
February 5, 2018

I agree with Ratna - never have I seen or read any material that suggests OSGI configuration values can be dynamically created. Lets see if other community members know of a way - if there is a way - its hidden functionality - not documented in docs or community articles.

smacdonald2008
February 5, 2018

Read this - you can change the values of them using code - not create them:

Programmatically updating OSGi configurations in AEM and Sling - Adobe Experience Manager | AEM/CQ | Apache Sling

February 5, 2018

Yes that's all I found. Is there maybe another way? start a the same service for every domain with different configs, without duplicating the service with another name?

GooglemapsService --> config.pl

GooglemapsService --> config.com

GooglemapsService --> config.nl

...

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
February 6, 2018

Hi,

Don't use OSGI for this. Setting OSGI configs might cause internal rebindings of services, potentially causing temporary failures on requests. Also this requires sufficient privileges, and I would not want to grant an ordinary author (even he's allowed to update the API keys) these privileges.


Rather use the Sling Context Aware Configuration, which is more appropriate and gives you multitenancy for free :-)

Apache Sling :: Apache Sling Context-Aware Configuration