A clever .env
vne now supports the typed variable syntax of env-smart!
$ npm i vne
; // ES6// const env = require("vne"); // ES5console; // your .env file as an Object
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.