What's the best way to disable a ColdBox module in...
# box-products
a
What's the best way to disable a ColdBox module in dev? For example I am using the Sentry module but I don't want it enabled on local dev. I've added this to my
development
environment function
moduleSettings.sentry.enableExceptionLogging = false;
to override the setting from the main
moduleSettings
. The other option (I think) is to append to the
modules.exclude
array (for dev). So wondering what the smart folks do 🙂 Thanks
w
I don’t consider myself one of these smart folks because I never excluded modules from dev, but what you are suggesting seems to be the easiest route: append it to the array of excluded modules and do this in your dev function eg:
Copy code
function development(){
    modules.exclude.append("someModule")
}
g
Another option could be to create an env variable to control whether it's enabled and have that value populate the
enableLogBoxAppender
setting in ColdBox.cfc
a
I've gone with:
Copy code
function development(){
    moduleSettings.sentry.enableExceptionLogging = false;
}
That way - the module does load on dev (which is handy for testing) but doesn't send errors to Sentry endpoint
l
both approaches are good
w
Some update on this: I disabled sentry in my dev environment, but this was not enough, since I was using logbox as wel, so I had to change it to
Copy code
function development(){
    moduleSettings.sentry.enableExceptionLogging = false;
    moduleSettings.sentry.enableLogBoxAppender = false;
}
Because I did not want any sentry activity at all in my dev environment now I could also go for:
Copy code
function development(){
    modules.exclude.append("sentry")
}
I guess both approaches are very effective 🙂 In the second option I don’t have to worry about sentry settings at all.