Clarification on the node DEBUG example
StingyJack opened this issue · 3 comments
To see what the engine is doing under the hood, debug output can be turned on via:
Node
DEBUG=json-rules-engine
Is this a command line parameter, an environment variable, etc?
See here:
https://github.com/CacheControl/json-rules-engine/blob/master/src/debug.js
If you are using Node.js, then "json-rules-engine" needs to be in an environment variable called DEBUG
. You may also add other stuff to the same environment variable (e.g. if you are using the debug package in your application).
@UncleSamSwiss - Thanks. Is using DEBUG like this this a common approach for nodejs programs? I've always tried to avoid ev's with generic names like that (or CONFIGURATION, PLATFORM, etc.) and used things like MY_PROGRAM_NAME_ENABLE_DEBUG, etc
Is using DEBUG like this this a common approach for nodejs programs?
No it isn't common and I would probably never use it this way - except for DEBUG.
First of all, the debug library and also json-rules-engine
only check if a certain substring is in the variable.
And second: except when containerized I would never change my system environment variables, but only prepend it to the execution of the command. This way the environment variable is only valid for the command itself.