DEV Community

Discussion on: You’re Doing Environment Variables All Wrong - A Node.js Perspective

Collapse
 
aminmansuri profile image
hidden_dude

We have to be defensive and paranoid with any inputs to our program. Including configuration values.

My rule of thumb is to make type checks easy to write. So for example creating a "confirmation" library where I can say C.int(number) that will throw an exception if the wrong type is entered.

If it's easy and quick to write you can riddle your code with it. It can also handle logging automatically and if the language permits, get the line number of the detected bug.