Dynamically making changes to coldbox configuration post load

One coldbox.cfc has been loaded, I need to be able to dynamically change some values…these are values the user can defined for the whole application. For example, the user has only one dsn but can change between mutliple schemas within that database. The question I have, particularly for anyone that has needed to do this, is:

Where best to do something like this…interceptor, plugin
When best to do it…interception point, application.cfc
How to warehouse the user definable data…json configuration file or database…and if the latter, how are my choices limited to access things?

No matter what, when the user commits to some change, the framework must be reinitialized, which is fine…and I thought I might consider just writing code to rewrite the coldbox.cfc but that’s not a good choice in my mind. I really like the json data approach…the current system has way more options that are user definable then need to be in the rewrite so what I was thinking, using the DSN example, is after coldbox.cfc is loaded, a JSON configuration file is loaded and then using the exposed api to control coldbox config, I’d update those values. This only needs to happen at the application scope level.

Any thoughts?

Mike

Are you using ORM?

no

Then you can change the DSN any time you like, and an interceptor is just as good as any to do the job. But the caveat is that if you are to ever migrate to ORM, then the rules change.

If the Site is to use one DSN, then after configuration load would be your best option, if there is other factors after that then you could use the appropriate interception point to make the change.

Thanks for the input Andrew…appreciated as always.

Mike