Skip to content

wolff453/dotenv-addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotenv-addon

If you found a bug, please open an issue.

A package with add-ons to make the job easier when used in conjunction with dotenv

With this package, you will be able to convert your config env file with your respective data structures declarated in .env file and interpolate the strings.

Example with parsed config object:

env-parsed

To see all the parses that you can use and how you can interpolate, see the .env.example file

Installation

First install the plugin via npm.

npm install dotenv-addon

Usage Example

const env = require('dotenv').config()
const { expandEnv } = require('dotenv-addon')

module.exports = expandEnv({
    dotEnvObject: env.parsed,
    config: {
        app: {
            name: process.env.APP_NAME,
            port: process.env.PORT,
            env: process.env.NODE_ENV,
            host: process.env.TEST_ENV_INTERPOLATE,
            booleanConvert: process.env.TEST_BOOLEAN_CONVERT,
            arrayConvert: process.env.TEST_ARRAY_CONVERT,
            objectConvert: process.env.TEST_OBJECT_CONVERT
          },
    },
    interpolateEnv: true
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published