Osgiconfig precedence for same pid with submodules and parent | Community
Skip to main content
Adobe Employee
December 11, 2023
Solved

Osgiconfig precedence for same pid with submodules and parent

  • December 11, 2023
  • 3 replies
  • 1077 views

Hi Team,

In AEMaaCS We have git submodules to our main parent repo and have only read access to submodules.
There is one Osgiconfig called "com.day.cq.commons.impl.ExternalizerImpl.cfg" in both submodules as well as parent repo.
Then given module order in main pom.xml as below

:<module>parent all<module>
<module>parent core<module>
<module>parent ui.config<module>
<module>submodule<module>


Now the issue seems to be submodule osgiconfig always takes precendencein publish  but we need our main parent osgiconfig value to be populated. In both repo, Osgiconfig is present in config.publish folder

 

please help what we need to do in this case.

 

 

@aanchalsikka @arunpatidar 

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 Mahedi_Sabuj

Yes, config.publish.dev folder should take precedences and populate parent config values.

3 replies

Jagadeesh_Prakash
Community Advisor
Community Advisor
December 11, 2023

@amsalek4  You can not have the same name for the OSGi in submodules and parent modules, try below solution 

 

com.day.cq.commons.impl.ExternalizerImpl.cfg~submodule1.cfg.json

com.day.cq.commons.impl.ExternalizerImpl.cfg~sumodule2.cfg.json

com.day.cq.commons.impl.ExternalizerImpl.cfg~parentmodule.cfg.json

Amsalek4Adobe EmployeeAuthor
Adobe Employee
December 11, 2023

Hi @jagadeesh_prakash 

I tried this. its not working. I hope this (com.day.cq.commons.impl.ExternalizerImpl.cfg~parentmodule.cfg.jsonis for osgi factory configs right where we can create multiple configs for each scenario. but when we don't have option to create multiple in ootb config example AEMEnvironmentalindicator, ExternalizerImpl.

Mahedi_Sabuj
Community Advisor
Community Advisor
December 11, 2023

If you did not check this answer by @arunpatidar, deeper paths (submodule) in the repository takes higher precedence. As OSGI configuration that has the most matching run modes is used, yow can update your parent osgiconfig folder like config.[environment].publish.

Order of Precedence:

  • Configuration settings are applied based on an order of precedence. The settings in the /apps directory take precedence over /libs settings.
  • Run mode-specific settings take precedence over common settings.
  • If there are multiple configurations under the same run mode, the order of the paths in the repository matters.
  • Configurations at deeper paths in the repository structure take precedence.
Mahedi Sabuj
Amsalek4Adobe EmployeeAuthor
Adobe Employee
December 11, 2023

@mahedi_sabuj 

Thanks, In our case, how to populate our parent config values? do we need to change the folder name.?

current one : config.publish. if changing folder name to config.publish.dev would work?

Mahedi_Sabuj
Community Advisor
Mahedi_SabujCommunity AdvisorAccepted solution
Community Advisor
December 11, 2023

Yes, config.publish.dev folder should take precedences and populate parent config values.

Mahedi Sabuj
joerghoh
Adobe Employee
Adobe Employee
December 22, 2023

The Externalizer is not a factory service, that means there is just 1 configuration active. If you have 2 configurations in your repo, one will be active (either predictable or not), but that's probably not what you want.

First, you need to define what the actual value should be, and as next step you need to define, where you want to maintain it. Because if every team can decide on its own, what OSGI configuration they want and expect, you will likely end up with many problems.