[coldbox-3.5.2] overriding module settings from host app on load

what is the best practice for this?

an interception point function in the config?

Could you explain a little more what your asking?

Are your asking to override module settings, when the module loads or the application loads? What sort of settings are we talking about, custom settings or module specific settings?

There could be two or three ways to approach the problem, depending on what your trying to achieve, but yes one of those methods would be an interceptor approach.

hey, andrew.

once the host app loads, it will override settings in a module. the setting is a custom setting for the module (not a parent setting override). if no override is specified in the host app, the default is used. its for a jqueryUI theme.

my replies are deleting.

brad… it seems to not be working. the onload() for my module overwrites its setting struct but when called from an injected property, it doesnt reflect the change.

in an afterAspectsLoad, in the host app config, i cant access any module settings from the controller. probably because they have yet to load.

Ok, so if I understand this, what your saying is that you have a setting that if set will use the module theme or the application them?

Have you thought about looking at the modules settings, layoutParentLookup and viewParentLookup?

Without knowing more, it sounds very much these settings is what you need. It basically says that if either is set to true, it will load the theme from the application theme or layout and if either is set to false it will use the layout and views from the module.

Now, if your asking if you can modify this, you can override those module settings by using the postModuleLoad to listen for when the module is loaded, or even the preModuleLoaded, to load the module settings layoutParentLookup or viewParentLookup to what you want or need.

Am I close to what it is you are trying to achieve?


i have another module that is only for security. it uses settings like useFirewall, isExtranet, useActiveDirectory. i have an application that is internal that uses active directory to authenticate. i have another app that is public facing for extranet users, etc.

right now, i have to declare all the settings for that module in the host apps config file. i would like to default all the settings in the module then overwrite which ever settings id like in the host app.

still at a lost on this.

even on postModuleLoad(), cannot access any module settings. the docs say they are avail in handlers, views, and interceptors but i dont want to split my settings into a config and an interceptor.

have decided to put the module settings in parentSettings in the module config and use this in the host app config:

function postModuleLoad(){

with testing, i did find this incongruence:

parentSettings.mySetting in module config is equal to 5.

dev() in host app config sets settings.mySetting = “99999”.

in postModuleLoad() in host app config…

writeDump(settings.mySetting) outputs 5.

writeDump(controller.getSetting(“mySetting”)) outputs 99999.