Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Create and Set OSGI config variable through dialog

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

6 Replies

Avatar

Level 10

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

Avatar

Level 4

Thanks Ratna

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

Avatar

Level 10

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.

Avatar

Level 4

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

...

Avatar

Correct answer by
Employee Advisor

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