A clever .env
vne is not yet compatible with
$ npm i vne -S
; // const env = require("vne"); works tooconsole; // your .env file in object format
Take this sample
vne takes the
.env file and produces an object like this:
Variables with names differentiated by numbers are intelligently placed into an array for easy iteration. A use case would be a handful of tokens you want to have admin access to your API.
Other variables in your
.env file with a
. gets placed into a nested object for easy querying. That way, you will be able to do something like this (check the
That one-liner checks to see if your app is running in a
development environment or not (of course, this assumes that you are setting your environment when starting your app). Check out the
scripts section of this
package.json file for reference.
Anyhoo, if your app is running in
development mode the parameter on the left side of the
: will be called. If not (it's running in
production mode), the parameter on the right side is called.