Expand my Community achievements bar.

SOLVED

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

Avatar

Level 9

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

Avatar

Correct answer by
Level 9

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

Avatar

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?

Avatar

Level 9
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?

Avatar

Community Advisor

Hi @TB3dock ,

 

It should be available in config Manager.

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

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

Avatar

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

Avatar

Level 9

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.

Avatar

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.

Avatar

Correct answer by
Level 9

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

Avatar

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



Arun Patidar

Avatar

Level 9
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.