Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

osgi config file not working (not appearing in config manager). Incorrect name?

TB3dock
Level 7
Level 7

In order to create a cors entry, we created a file:

 

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

 

When we deploy the project to the local author instance using mvn clean install -PautoInstallSinglePackage in the root, then look in the config manager, it is not there.  Should it be?

Here I am assuming that when you run the AEM SDK locally, its in dev run mode.

 

TB3dock_0-1620373273134.png

above is only a config which was manually created.  We would expect our mypp config to also be there.

 

The contents were this:

 

 

{
  "alloworigin":["*"],
  "alloworiginregexp":[],
  "allowedpaths":[".*"],
  "exposedheaders":[""],
  "maxage":1800,
  "supportedheaders":["*"],
  "supportedmethods":["GET","POST"],
  "supportedcredentials":"true"
}

 

 

 

1 Accepted Solution
rush_pawan
Correct answer by
Community Advisor
Community Advisor

Hello,

Just to add, the local config file name should not have "-" in the file name rather use "~" to make it work. so create the file name as

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl~myapp.cfg.json

View solution in original post

10 Replies
Vaibhavi
Community Advisor
Community Advisor

Hi @TB3dock ,

 

Please have a check in crx if the newly created config is available in the below path.

/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

Also please confirm if your local instance run mode is set to dev?

TB3dock
Level 7
Level 7
Yes, its in the CRX viewer, but not in the osgi config viewer. I am running locally, so must be dev. How do you verify?
Prince_Shivhare
Level 9
Level 9

Hi @TB3dock ,

 

It should be available in config Manager.

you should keep the file in the part mentioned by @Vaibhavi .

and make sure you are building all the modules in maven not only the ui.apps.

it should deploy it to config Manager. Also, check-in CRXDE if you are able to see this in osgiconfig node.

2.PNG
Thanks,

Prince

asutosh_jena
Community Advisor
Community Advisor

Hi @TB3dock 

 

Your configuration is created under config.author.dev which will be used only for the developement author environment.

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

if your current instance is running on dev, author runmode, you will be able to see the above config under system/console/configMgr, else it will not be picked by the instance even though it is present under /apps/myapp/osgiconfig/config.author.dev

 

if you want it to be available on your local author instance, put it either to /apps/myapp/osgiconfig/config or create a new run mode such as /apps/myapp/osgiconfig/config.author.local and set the run mode in the sling.properties file as a property like "sling.run.modes=local, author"

 

Hope this helps!

 

Thanks

TB3dock
Level 7
Level 7

We assume because we are running the author instance locally, it must be in dev mode, as its not stage or prod, and there are only 3 possibilities.  We don't have a sling.propertiers file currently.

asutosh_jena
Community Advisor
Community Advisor

Hi @TB3dock 

 

In felix console navigate to Status -> Sling Setting else navigate to http://localhost:4502/system/console/status-slingsettings URL

It will have a poperty as Run Modes

Run Modes = [s7connect, crx3, author, samplecontent, crx3tar]

 If you have only the above values, then the config should work. If you have dev in the above entry then it will be considered as the development environemnt and config.author.dev runmode will be picked.

rush_pawan
Correct answer by
Community Advisor
Community Advisor

Hello,

Just to add, the local config file name should not have "-" in the file name rather use "~" to make it work. so create the file name as

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl~myapp.cfg.json

View solution in original post

Arun_Patidar
Community Advisor
Community Advisor

Hi

local AEM SDK does not contain dev run mode by default. you can set though using command line when you start aem or set in sling:properties file.

you can varify run modes on instance at http://localhost:4502/libs/granite/operations/content/systemoverview.html

TB3dock
Level 7
Level 7
Thanks, I had assumed that local dev instance would be in dev mode, this solved the main problem. Sadly, that system overview link doesnt work on the target cloud instances, only local SDK.