06o1cg
Last Updated: February 25, 2016
·
538
· adamyanalunas

Check environment variables before node.js app starts

Sanity.js is a small library that checks a list of environment variables are set and meet your format requirements before your app starts up.

Here's a quick snippet of how it could be used:

var sanity = require('sanity');

sanity.check(['USER', 'MACHTYPE', 'INVISIBLE_FRIENDS', 'AREA_51']);

// Output if INVISIBLE_FRIENDS and AREA_51 are undefined
ERROR: Required settings are not correct!
  INVISIBLE_FRIENDS: undefined
  AREA_51: undefined

Full documentation (and tests!) are a the sanity repo.

Say Thanks
Respond