Hi,
I'm wondering if there is a possibility to have an environment variable for the OSGi config that is accepting an array. If yes, how? Currently, in AEM Cloud Environment Variables, I can see that the environment variables are accepting single-string items.
In my case, I have a resource change listener which listens to multiple paths (reading them from the OSGi configuration), and I would like to have these paths authorable so we could add more of them if required in the future, in order to avoid the whole development process to get to PROD with a single change in the OSGi configuration.
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Though I am a little confused about the expectation from OSGi config properties and environment variables. But I think you would like to run the listener for different resource paths, and you want it to be authorable.
To achieve that do the following
- put the paths via multi field (path browser) in a page(static) properties (for example /content/configs)
- In your listener code, read the paths from that page properties and register the listener against the authored path dynamically by the method setAdditionalPaths(paths) from org.apache.jackrabbit.api.observation.JackrabbitEventFilter
See if this makes sense..
Though I am a little confused about the expectation from OSGi config properties and environment variables. But I think you would like to run the listener for different resource paths, and you want it to be authorable.
To achieve that do the following
- put the paths via multi field (path browser) in a page(static) properties (for example /content/configs)
- In your listener code, read the paths from that page properties and register the listener against the authored path dynamically by the method setAdditionalPaths(paths) from org.apache.jackrabbit.api.observation.JackrabbitEventFilter
See if this makes sense..
Hello @matzikica
If the paths are configured via an OSGi config, you should be able to configure runmode specific configs for this OSGi Service.
Are the paths updating frequently, that you need to control it via CM configs?
I am not entirely sure, but you could try something like this as the entry of the value.
["value1","value2","value3"]
That should be parsed as multi-value.
@matzikica Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies