{"_id":"@blakedy/dotenv-extended","_rev":"4-7f48c0824d5f2110305a7791e431df17","name":"@blakedy/dotenv-extended","dist-tags":{"latest":"2.2.0"},"versions":{"2.1.0":{"name":"@blakedy/dotenv-extended","version":"2.1.0","description":"A module for loading .env files and optionally loading defaults and a schema for validating all values are present.","repository":{"type":"git","url":"git+ssh://git@github.com/wallabyfinancial/node-dotenv-extended.git"},"main":"lib/index.js","types":"dotenv-extended.d.ts","bin":{"dotenv-extended":"lib/bin/index.js"},"scripts":{"test":"gulp unittest","coveralls":"cat ./coverage/lcov.info | coveralls","lint":"gulp lint","prepublish":"gulp build"},"keywords":["dotenv","environment"],"author":{"name":"Keith Morris","email":"standupbass@gmail.com","url":"http://standupbass.wordpress.com/"},"contributors":[{"name":"Blake Dy","email":"me@blakedy.com","url":"http://blakedy.com/0"}],"license":"MIT","devDependencies":{"babel-core":"6.26.0","babel-eslint":"8.2.3","babel-plugin-transform-object-rest-spread":"^6.8.0","babel-preset-es2015":"^6.5.0","chai":"4.1.2","coveralls":"3.0.0","del":"3.0.0","eslint":"4.19.1","eslint-config-standard":"11.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"6.0.1","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","gulp":"^3.9.1","gulp-babel":"7.0.1","gulp-eslint":"4.0.2","gulp-istanbul":"^1.1.1","gulp-mocha":"5.0.0","mockery":"^2.0.0","run-sequence":"2.2.1","sinon":"4.5.0","sinon-chai":"3.0.0"},"babel":{"presets":["es2015"],"plugins":["transform-object-rest-spread"]},"dependencies":{"@types/dotenv":"^4.0.0","auto-parse":"^1.3.0","camelcase":"5.0.0","cross-spawn":"6.0.5","dotenv":"5.0.1","is-windows":"^1.0.0","lodash":"^4.3.0"},"gitHead":"2203c2f6d56eaa63f7d8ec1e36a10fe6e350a21a","bugs":{"url":"https://github.com/wallabyfinancial/node-dotenv-extended/issues"},"homepage":"https://github.com/wallabyfinancial/node-dotenv-extended#readme","_id":"@blakedy/dotenv-extended@2.1.0","_shasum":"e8a1207ae775270ec6cc16d479bec422455d763d","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"blakedy","email":"me@blakedy.com"},"dist":{"shasum":"e8a1207ae775270ec6cc16d479bec422455d763d","tarball":"https://registry.npmjs.org/@blakedy/dotenv-extended/-/dotenv-extended-2.1.0.tgz","fileCount":13,"unpackedSize":234822,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/xbsCRA9TVsSAnZWagAAzHsP/R7u13Ws7as+x9fWKQ1o\np6dHwagcO0j1zk8xPBgmx49uDJo5JsZD0Agy2l2nQVyPu/XTzTFnVUgEjMtg\nu1GNJgSp+WIkYMincDrJxzkYdqujjdwFLqRYBftkcUOymeMx/5jH5Cf/bcz6\nmnsnpzsubpL31a0BBmmntw/+hoTKRfWDNsy6/bn+O3AolMbZKQgPImDVFcAZ\nefCJJSm4j5qDfWKqjYV+eIoS4C8w8l9Ay00CvHtfTwb+YCYNWwcJ4hWmB7S4\nUjAjcZJGrNxAyemUSRdheIuOcNQ8FWKGB0c6n+M+gCcCrbAhuTtVMF3Didzo\nOlX+lf006ZFFn9+c2VoItDBe82SSWzX4NMhC4ylnctMg7OPO9HyYh6amsapy\nh+erGNO8UgQKsNgSiWd8v40Xbwy2Sncfd8XBhO39XnPFOboSQEt9bgiBvtDo\nZNhbLO7G4BVshZB/JrV/vHwWWuzW49ld8q+PaTyTQH11Bik1ypVf1q89NLIx\nTmwfwTekOAPs2M6iGAzJRSmzNmyRm1bVEnIvKyzSBFIgmnhpcDeZDf4r/Pe4\n/fslVK0Wu73UqA4e12qbOd5CtKO587npfwnYp4ocbyu1DzxBzYEKq2l/0UhK\nQtYlEXAU98YaR68vU2i6X3RBAOeVCHbLVdaN/2QtNB4foR2+hmyCxuoAUcUD\nU7li\r\n=orMR\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-eClsXa7FHKlmL/pLeutlaux/bOCOzbebz7zb5dw2YOQ8RhD1tVoiR1qDN06NqZmnfWuvYFzawRM2TX6adHaIIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHU/HKsDeMsDF0X2hOJku89HSW8sLkJvSd2jjxSggiB2AiEA6hHL3e2ONTJKM6Q9ZdC5TZhPf5Qcp99g+mB+H0ibZxA="}]},"maintainers":[{"name":"blakedy","email":"me@blakedy.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dotenv-extended_2.1.0_1526666986273_0.7652791249487125"},"_hasShrinkwrap":false},"2.2.0":{"name":"@blakedy/dotenv-extended","version":"2.2.0","description":"A module for loading .env files and optionally loading defaults and a schema for validating all values are present.","repository":{"type":"git","url":"git+ssh://git@github.com/wallabyfinancial/node-dotenv-extended.git"},"main":"lib/index.js","types":"dotenv-extended.d.ts","bin":{"dotenv-extended":"lib/bin/index.js"},"scripts":{"test":"gulp unittest","coveralls":"cat ./coverage/lcov.info | coveralls","lint":"gulp lint","prepublish":"gulp build"},"keywords":["dotenv","environment"],"author":{"name":"Keith Morris","email":"standupbass@gmail.com","url":"http://standupbass.wordpress.com/"},"contributors":[{"name":"Blake Dy","email":"me@blakedy.com","url":"http://blakedy.com/0"}],"license":"MIT","devDependencies":{"babel-core":"6.26.0","babel-eslint":"8.2.3","babel-plugin-transform-object-rest-spread":"^6.8.0","babel-preset-es2015":"^6.5.0","chai":"4.1.2","coveralls":"3.0.0","del":"3.0.0","eslint":"4.19.1","eslint-config-standard":"11.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"6.0.1","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","gulp":"^3.9.1","gulp-babel":"7.0.1","gulp-eslint":"4.0.2","gulp-istanbul":"^1.1.1","gulp-mocha":"5.0.0","mockery":"^2.0.0","run-sequence":"2.2.1","sinon":"4.5.0","sinon-chai":"3.0.0"},"babel":{"presets":["es2015"],"plugins":["transform-object-rest-spread"]},"dependencies":{"@types/dotenv":"^4.0.0","auto-parse":"^1.3.0","camelcase":"5.0.0","cross-spawn":"6.0.5","dotenv":"5.0.1","is-windows":"^1.0.0","lodash":"^4.3.0"},"gitHead":"263b1ad8d0a982be0e86998d986439b620067c23","bugs":{"url":"https://github.com/wallabyfinancial/node-dotenv-extended/issues"},"homepage":"https://github.com/wallabyfinancial/node-dotenv-extended#readme","_id":"@blakedy/dotenv-extended@2.2.0","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"blakedy","email":"me@blakedy.com"},"dist":{"integrity":"sha512-sZzmKa3/TSIoOnNGVeaQNjHe5nxKibMqEipuFfs/cC2gPf7lrvn5DYNPmim1DXiU9WvfR6U2b50NQksQkoP1xQ==","shasum":"4201299a348999f52e4f3a57f0a22266ae4d59a9","tarball":"https://registry.npmjs.org/@blakedy/dotenv-extended/-/dotenv-extended-2.2.0.tgz","fileCount":11,"unpackedSize":24000,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBLZZCRA9TVsSAnZWagAA5EcP/37Z0PCLE9H5EcxXuGhq\nOs8wxk0jJAfQmfRyShY7RRJUYb5FLHRxj4E2qI5dlDZxv/U63S9sOIBFEJ2k\nzD6UVxcd7Yp/KUkkaxW92Oqm8ugZGykKCPqu0Px3w8FmOPHO7XtejAzbH/6k\nUYhVQbMI0VqZvi5ddu3oMx82Owwqc4U4fkGinAv6BbF6XkxXFLVZABeb3rqn\nhgn62AwlQwseqxJgy8cohDZ6V04ehSVLC9MmdbI+zPDofPzVYcEPY1TCopWU\n3991ztXMDAJQ21+yBW1OTH6updFrPwFl+R5WcyP2qvhMJcWKvahKjxHKLEE5\nBzidOdJFkoczvz8t2B2fZ98Vdka2LOvvX4LeotNpT72WlGmYiZ3Z9cGHdibn\nX0/biDyPovQjwn6OF4c86fi0+lHj7Xm2u3nHtcPZ2KrRIPf44yJqfHV01IFs\nIKB659oT9sFJ91AtVYtmUL/AW0ZV7bhkiSfInu3VyjT1ux15crh60AyKAwMj\nukoxDad7NiUDoeFa60u2K0kiPdKzFxI8JPf3h6HPiM6s13IzyRlDvngiH4G8\nfPfCuHaO8rjgLxW70EjRxWN/QsSSnTikzGoVb7UIeAcuvPKUcPdBzLx8K0NF\ngJAvSURtGUJCEDDd/iBJTRqxWZxGXAei5zxQS4iBd39Psj9Fyu0gyKTMnCOv\n0EFz\r\n=irNG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGwOOJQvqeqV8pH5t483j2J46P7E0+5FHZk8MYmMcVclAiEArDtN3gtpLd2wjBUpWTo3aIxAFiVQOJOH9gSFfM/cxxU="}]},"maintainers":[{"name":"blakedy","email":"me@blakedy.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dotenv-extended_2.2.0_1527035479651_0.2946416084502117"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-18T18:09:45.955Z","2.1.0":"2018-05-18T18:09:46.766Z","modified":"2022-06-12T15:20:53.308Z","2.2.0":"2018-05-23T00:31:19.799Z"},"maintainers":[{"name":"blakedy","email":"me@blakedy.com"}],"description":"A module for loading .env files and optionally loading defaults and a schema for validating all values are present.","homepage":"https://github.com/wallabyfinancial/node-dotenv-extended#readme","keywords":["dotenv","environment"],"repository":{"type":"git","url":"git+ssh://git@github.com/wallabyfinancial/node-dotenv-extended.git"},"contributors":[{"name":"Blake Dy","email":"me@blakedy.com","url":"http://blakedy.com/0"}],"author":{"name":"Keith Morris","email":"standupbass@gmail.com","url":"http://standupbass.wordpress.com/"},"bugs":{"url":"https://github.com/wallabyfinancial/node-dotenv-extended/issues"},"license":"MIT","readme":"# dotenv-extended\n\n[![Build Status](https://travis-ci.org/keithmorris/node-dotenv-extended.svg?branch=develop)](https://travis-ci.org/keithmorris/node-dotenv-extended)\n[![Coverage Status](https://coveralls.io/repos/github/keithmorris/node-dotenv-extended/badge.svg?branch=develop)](https://coveralls.io/github/keithmorris/node-dotenv-extended?branch=develop)\n[![Dependency Status](https://david-dm.org/keithmorris/node-dotenv-extended.svg)](https://david-dm.org/keithmorris/node-dotenv-extended)\n\n\nI've been a big fan of the [dotenv] for a quite some time (in fact, this library uses [dotenv] under the hood for the `.env` file parsing). However, while working on some bigger projects, we realized that the managing of the `.env` files became a bit of a chore. As the files changed in the development environments, it became a tedious manual process to compare and figure out what needed to be added or removed in the other environments.\n\nThis library solves some of these issues by introducing the concept of 3 files which are used together to provide environment-specific variables, default values and a validation schema:\n\n### `.env`\n\nThe environment specific file (not committed to source control). This file will have sensitive information such as usernames, passwords, api keys, etc. These would be specific to each environment and should not be committed to source control. The format is a series of key-value pairs. Any line starting with `#` or `;` are commented out and ignored.\n\n```\n# .env file\nMONGO_HOST=localhost\nMONGO_DATABASE=TestDB\nMONGO_USER=dbusername\nMONGO_PASS=dbpassword!\n```\n\n### `.env.defaults`\n\nCommon configuration defaults across all environments (commited to source control). This contains overall app configuration values that would be common across environments. The `.env.defaults` file is loaded first and then the `.env` file is loaded and will overwrite any values from the `.env.defaults` file. Format is identical to the `.env` file.\n\n### `.env.schema`\n\nDefines a schema of what variables _should_ be defined in the combination of `.env` and `.env.defaults`. Optionally, you can have the library throw an error if all values are not configured or if there are extra values that shouldn't be there.\n\n\nThe `.env.schema` file should only have the name of the variable and the `=` without any value:\n\n```\nMONGO_HOST=\nMONGO_DATABASE=\nMONGO_USER=\nMONGO_PASS=\n```\n\n\nI have tried to stay as compatible as possible with the [dotenv] library but there are some differences.\n\n## Installation\n\n```\nnpm i --save dotenv-extended\n```\n\n## Usage\n\nAs early as possible in your main script:\n\n```\nrequire('dotenv-extended').load();\n```\n\nCreate a `.env` file in the root directory of your project. Add environment-specific variables on new lines in the form of `NAME=VALUE`.\n\nFor example:\n\n```\nMONGO_HOST=localhost\nMONGO_DATABASE=TestDB\nMONGO_USER=dbusername\nMONGO_PASS=dbpassword!\n```\n\n`process.env` now has the keys and values you defined in your `.env` file.\n\n```javascript\nmongoose.connect('mongodb://' + process.env.MONGO_HOST + '/' + process.env.MONGO_DATABASE, {\n    user: process.env.MONGO_USER,\n    pass: process.env.MONGO_PASS\n});\n```\n\n### Load Configs from command line\n\nYou may also load the `.env` files from the command line. Add in the require `dotenv-extended/config` along with any of the options that the `load` method takes prefixed with `dotenv_config_`. e.g.:\n```\nnode -r dotenv-extended/config your_script.js\n```\n\nOr to specify load options:\n\n```\nnode -r dotenv-extended/config your_script.js dotenv_config_path=./env/.env dotenv_config_defaults=./env/.env.defaults\n```\n\n### Load Environment Variables and pass to non-NodeJS script\n\nNew in 2.0.0, is a feature inspired by [cross-env](https://www.npmjs.com/package/cross-env) to allow you to load environment variables from your `.env` files and then pass them into a non-NodeJS script such as a shell script. This can simplify the process of maintaining variables used in both your Node app and other scripts. To use this command line executable, you will either need to install globally with the `-g` flag, or install `dotenv-extended` in your project and reference it from your npm scripts.\n\nInstall Globally:\n\n```\nnpm install -g dotenv-extended\n```\n\nNow call your shell scripts through `dotenv-extended` (this uses the defaults):\n\n```\ndotenv-extended myshellscript.sh --whatever-flags-my-script-takes\n```\n\nConfigure `dotenv-extended` by passing any of the dotenv-extended options before your command. Preceed each option with two dashes `--`:\n\n```\ndotenv-extended --path=/path/to/.env --defaults=/path/to/.env.defaults --errorOnMissing=true myshellscript.sh --whatever-flags-my-script-takes\n```\n\nThe following are the flags you can pass to the `dotenv-extended` cli with their default values. these options detailed later in this document:\n\n```bash\n--encoding=utf8\n--silent=true\n--path=.env\n--defaults=.env.defaults\n--schema=.env.schema\n--errorOnMissing=false     # or --error-on-missing=false\n--errorOnExtra=false       # or --error-on-extra=false\n--includeProcessEnv=false       # or --include-process-env=false\n--assignToProcessEnv=true  # or --assign-to-process-env=true\n--overrideProcessEnv=false # or --override-process-env=true\n```\n\n## Options\n\nDefaults are shown below:\n\n```\nrequire('dotenv-extended').load({\n\tencoding: 'utf8',\n\tsilent: true,\n\tpath: '.env',\n\tdefaults: '.env.defaults',\n\tschema: '.env.schema',\n\terrorOnMissing: false,\n\terrorOnExtra: false,\n\tincludeProcessEnv: false,\n\tassignToProcessEnv: true,\n\toverrideProcessEnv: false\n});\n```\n\nThe function always returns an object containing the variables loaded from the `.env` and `.env.defaults` files. The returned object does not contain the properties held in `process.env` but rather only the ones that are loaded from the `.env` and `.env.defaults` files.\n\n```\nvar myConfig = require('dotenv-extended').load();\n```\n\n### encoding (_default: utf8_)\n\nSets the encoding of the `.env` files\n\n### silent (_default: true_)\n\nSets whether a log message is shown when missing the `.env` or `.env.defaults` files.\n\n### path (_default: .env_)\n\nThe main `.env` file that contains your variables.\n\n### defaults (_default: .env.defaults_)\n\nThe file that default values are loaded from.\n\n### schema (_default: .env.schema_)\n\nThe file that contains the schema of what values should be available from combining `.env` and `.env.defaults`\n\n### errorOnMissing (_default: false_)\n\nCauses the library to throw a `MISSING CONFIG VALUES` error listing all of the variables missing the combined `.env` and `.env.defaults` files.\n\n### errorOnExtra (_default: false_)\n\nCauses the library to throw a `EXTRA CONFIG VALUES` error listing all of the extra variables from the combined `.env` and `.env.defaults` files.\n\n### includeProcessEnv (_default: false_)\n\nCauses the library add process.env variables to error checking. The variables in process.env overrides the variables in .env and .env.defaults while checking\n\n### assignToProcessEnv (_default: true_)\n\nSets whether the loaded values are assigned to the `process.env` object. If this is set, you must capture the return value of the call to `.load()` or you will not be able to use your variables.\n\n### overrideProcessEnv (_default: false_)\n\nBy defaut, `dotenv-entended` will not overwrite any varibles that are already set in the `process.env` object. If you would like to enable overwriting any already existing values, set this value to `true`.\n\n## Examples\n\nConsider the following three files:\n\n```\n# .env file\nDB_HOST=localhost\nDB_USER=databaseuser-local\nDB_PASS=databasepw!\nSHARE_URL=http://www.example.com\n```\n\n```\n# .env.defaults\nDB_USER=databaseuser\nDB_DATABASE=MyAppDB\n```\n\n```\n# .env.schema\nDB_HOST=\nDB_USER=\nDB_PASS=\nDB_DATABASE=\nAPI_KEY=\n```\n\n### Load files with default options\n\n```\nvar myConfig = require('dotenv-extended').load();\n\nmyConfig.DB_HOST === process.env.DB_HOST === \"localhost\"\nmyConfig.DB_USER === process.env.DB_USER === \"databaseuser-local\"\nmyConfig.DB_PASS === process.env.DB_PASS === \"localhost\"\nmyConfig.DB_DATABASE === process.env.DB_DATABASE === \"MyAppDB\"\nmyConfig.SHARE_URL === process.env.SHARE_URL === \"http://www.example.com\"\n```\n\n### Load files with `errorOnMissing`\n\n```\nvar myConfig = require('dotenv-extended').load({\n    errorOnMissing: true\n});\n\nThrows ERROR `MISSING CONFIG VALUES: API_KEY`\n```\n\n### Load files with `errorOnExtra`\n\n```\nvar myConfig = require('dotenv-extended').load({\n    errorOnExtra: true\n});\n\nThrows ERROR `EXTRA CONFIG VALUES: SHARE_URL`\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## Change Log\n\nSee [CHANGELOG.md](CHANGELOG.md)\n\n## License\n\nSee [LICENSE](LICENSE)\n\n[dotenv]: https://www.npmjs.com/package/dotenv\n","readmeFilename":"README.md"}