@kmccullough/env-config

1.0.2 • Public • Published

env-config

Parses environment config file/string with variable replacements

Installation

$ npm install @kmccullough/env-config

Usage

# Example environment config file/string
USER=1234
PASS=2345
CREDENTIALS=${USER}:${PASS}
loadConfig([ '.env', '.env-default' ], {
  // Path to prefix all given paths 
  rootPath: './',
  // Called for each file in given paths
  eachFileFn(fileExists, filePath, fullFilePath, skip, done) {
    skip(); // Skip parsing this file
    done(); // Stop parsing all files after this one
  },
  // Called for each config key value pair
  eachFileFn(key, value, skip, done) {
    skip(); // Skip this value in returned config (and replacements)
    done(); // Stop parsing configs after this one from this file
  },
})

License

MIT

Package Sidebar

Install

npm i @kmccullough/env-config

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

7.59 kB

Total Files

8

Last publish

Collaborators

  • subone