suede

0.0.2 • Public • Published

Suede

Suede is a module, inspired by dotenv, for loading environment variables from a suede.env.json file into process.env. The difference is that you must declare the environment for the imported function so that it could do a lookup in the JSON file to load any required environment variables.

Install

npm install suede or yarn add suede

Create a suede.env.json file and add specific variables needed in JSON relative to the root property.

Example:

{
    "test": {
        "DATABASE": "mongodb://localhost:27017/test",
        "BACKEND_ENDPOINT": "http://localhost:3000/"
    },
    "qa": {
        "DATABASE": "mongodb://localhost:27017/test",
        "BACKEND_ENDPOINT": "http://localhost:3000/"
    },
    "production": {
        "DATABASE": "mongodb://localhost:27017/test",
        "BACKEND_ENDPOINT": "http://localhost:3000/"
    }
}

It's that simple.

const mongoose = require('mongoose')
const suede = require('suede')

suede('test')
mongoose.connect(process.env.DATABASE)

Reason

The reason for building another environment variable manager is to help manage multiple environments and to simplify testing

Package Sidebar

Install

npm i suede

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

110 kB

Total Files

9

Last publish

Collaborators

  • mralanlee