http://coldfusion.com logo
a

aliaspooryorik

07/26/2022, 8:21 AM
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

wil-shiftinsert

07/26/2022, 11:51 AM
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

garciadev

07/26/2022, 2:07 PM
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

aliaspooryorik

07/26/2022, 3:34 PM
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

lmajano

07/26/2022, 7:38 PM
both approaches are good
w

wil-shiftinsert

08/13/2022, 12:27 PM
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.
8 Views