node-env-object

1.0.1 • Public • Published

node-env-object

Simple node module to convert an .env file to an js object.

Quick start

To be able to process envs from .env file load them first. I prefere the dotenv package from npm.

npm install dotenv https://github.com/kyromoto/node-env-object.git

An example .env:

api.port=300
api.host=0.0.0.0

To use node-env-object you need to integrate it in your application.

import dotenv from "dotenv"
import { getEnv } from "node-env-object"

dotenv.config()

const config = getEnv("api", ".")

This will transform the .env to an js object.

{
    "api" : {
        "port" : 3000,
        "host" : "0.0.0.0"
    }
}

Readme

Keywords

Package Sidebar

Install

npm i node-env-object

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.41 kB

Total Files

4

Last publish

Collaborators

  • kyromoto