{"name":"universal-dotenv","version":"1.5.0","description":"Robust Environment Configuration for Universal Applications.","main":"lib/index.cjs.js","module":"lib/index.esm.js","scripts":{"lint":"eslint .","fix":"eslint --fix .","format":"prettier --ignore-path .gitignore --write '**/*.js' && npm run fix","test":"jest","prepare":"rimraf lib && preppy","precommit":"lint-staged","release":"git push && release-it --github.release --npm.publish --non-interactive","release:minor":"git push && release-it --github.release --npm.publish --non-interactive --increment minor","release:major":"git push && release-it --github.release --npm.publish --non-interactive --increment major"},"engines":{"node":">=6.0.0","yarn":">=1.0.0","npm":">=6.0.0"},"keywords":["dotenv","universal","env"],"files":["lib/"],"license":"Apache-2.0","author":{"name":"Sebastian Software","email":"s.werner@sebastian-software.de","url":"https://www.sebastian-software.de"},"bugs":{"url":"https://github.com/sebastian-software/universal-dotenv/issues"},"homepage":"https://github.com/sebastian-software/universal-dotenv#readme","repository":{"type":"git","url":"git+https://github.com/sebastian-software/universal-dotenv.git"},"pre-commit":"lint-staged","lint-staged":{"*.js":"eslint"},"devDependencies":{"@babel/core":"^7.0.0-beta.51","babel-preset-edge":"^4.4.1","eslint":"^4.19.1","eslint-config-readable":"^1.14.0","flow-bin":"^0.74.0","husky":"^0.14.3","jest":"^23.1.0","lint-staged":"^7.2.0","preppy":"^4.2.2","prettier":"^1.13.5","rimraf":"^2.6.2"},"dependencies":{"app-root-dir":"^1.0.2","dotenv":"^6.0.0","dotenv-expand":"^4.2.0"},"gitHead":"156deb99367e4fda2995bfbbadcdefa145804616","_id":"universal-dotenv@1.5.0","_npmVersion":"6.1.0","_nodeVersion":"10.4.1","_npmUser":{"name":"swernerx","email":"s.werner@sebastian-software.de"},"dist":{"integrity":"sha512-bIyeEYIdk4r50MXRHFBY6ZQxop5wdNwVfQNyW60KQZHW31FHcTiQi6Cl/xNdDpOp1Z7OA7UPY5z+v21X++l21A==","shasum":"557361c85e207c02701a95495d4c22be608173c2","tarball":"http://registry-npm.ywwl.com/universal-dotenv/download/universal-dotenv-1.5.0.tgz","fileCount":7,"unpackedSize":32505,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbJ2hQCRA9TVsSAnZWagAAH7YP/R6kZR8sHzV9fxTZEDPD\nVkUd8n+uJde07OvNBk7BQrY0CJCZDUTkISemglBRB5d5LfPF9xXbDFDeBXsL\nZ1iiOJUJd52eEc28+9PaYjEsKkfBZqy/f0RwRCsx+XZTkL2qhXth0qyJwqWh\nBVAxnjP/J7CSctUHIACj5d4TYLdblS5c71Z9o9cyd+/VEsHVeuY4B97n7YUY\nu6cz1b/WgJJv4XSyjkmYychjVznyz3PIQh9IqF6VbEQTgr5jD0YheyMl2YiK\nX0OknW0a8TnL5TbvU6UzkP6F1lR4bz3nc5n5LEdFTjAIKqp/HbU3jOY5yvKR\n9Lou9JvdMvA7m5osBR+/2U7lHjzXfSpJzcj/kAdhB7Mgof+bQrWFFsMkSMDy\nA+ImxgIhGKOoerjFQBlDU2yUBhaM0ixlz9oFrv/5R56CMe9SgLNxoJo8UKpp\nOv/LtTQ133eB0vwqKKeurwnh48LFEQ9idZZ7tAyaGtTQWzqJk2cXSd8S9fdB\nlda8NRhBjbgX2G9p4bAF42QuOgRcFyalqQ/pVZDqBd1FMZlYooMgbwwN+rD1\nM2twQkCVyFyywdk/mH2tzCL5fjiU5o+ot4i9MI+ssBTp5rhZgR261p2Nq6Or\n/E+Yk0C92Bh50EzFLEOlOfFf3dTIAqDkBGvCR0RQfJ1G2Z1M1ScgyivNMBql\nuD+U\r\n=TENl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGNxvfnERnHK42uN/3+sGrDOs6llX1fbMvvXfzLhZ97OAiBRxjWJO6wUDCVo+Zw+Fv737Om2agPXFpxMWt3FS3U/fg=="}],"size":9157,"noattachment":false,"key":"/universal-dotenv/-/universal-dotenv-1.5.0.tgz"},"maintainers":[{"name":"swernerx","email":"s.werner@sebastian-software.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/universal-dotenv_1.5.0_1529309263616_0.5720218372495767"},"_hasShrinkwrap":false,"readme":"# Universal DotEnv<br/>[![Sponsored by][sponsor-img]][sponsor] [![Version][npm-version-img]][npm] [![Downloads][npm-downloads-img]][npm] [![Build Status][github-img]][github]\n\n[sponsor]: https://www.sebastian-software.de\n[npm]: https://www.npmjs.com/package/universal-dotenv\n[sponsor-img]: https://badgen.net/badge/Sponsored%20by/Sebastian%20Software/692446\n[npm-downloads-img]: https://badgen.net/npm/dm/universal-dotenv\n[npm-version-img]: https://badgen.net/npm/v/universal-dotenv\n[github]: https://github.com/sebastian-software/universal-dotenv/actions\n[github-img]: https://badgen.net/github/status/sebastian-software/universal-dotenv?label=tests&icon=github\n\nUniversal DotEnv - A Robust Environment Configuration for Universal Applications.\n\nThis solution is heavily inspired by the approach chosen by [Create React App](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env) and made available for general usage.\n\n## Features\n\n- Supports loading `.env` files with overriding between different `NODE_ENV` settings and `ENV_CONTEXT` configurations.\n- Automatically adds a `APP_ROOT` which points to the absolute root folder.\n- Also adds `APP_SOURCE` which points to the source folder.\n- Serializes all `APP_` prefixed environment variables for usage as `raw`, `stringified` or `webpack` (for `DefinePlugin`)\n- Supports variable expansion between different settings.\n- Allows local overrides using files which use a \".local\" postfix.\n\n## All Strings\n\nIt is important to remember that all environment variables are always stored as strings. Even numbers and booleans. The casting to other types must therefore take place in the application code. See also: https://github.com/motdotla/dotenv/issues/51\n\n## Variables\n\n- `NODE_ENV`: Typically either `production`, `development` or `test`\n- `ENV_CONTEXT`: Often used for e.g. `client` or `server`. Can be also something totally custom e.g. `docker`, `staging`, etc.\n- `APP_ROOT`: Points to the root folder of the application (absolute filesystem path)\n- `APP_SOURCE`: Points to the source folder. If `src` exists this is being used. Otherwise the assumption is that it's identical to the `APP_ROOT`.\n\n## File Priority\n\nFiles are being loaded in this order. Values which are already set are never overwritten. Command line environment settings e.g. via [cross-env](https://www.npmjs.com/package/cross-env) always win.\n\n- `.env.${ENV_CONTEXT}.${NODE_ENV}.local`\n- `.env.${ENV_CONTEXT}.${NODE_ENV}`\n- `.env.${ENV_CONTEXT}.local`\n- `.env.${ENV_CONTEXT}`\n- `.env.${NODE_ENV}.local`\n- `.env.${NODE_ENV}`\n- `.env.local`\n- `.env`\n\nNote: `local` files without `NODE_ENV` are not respected when running in `NODE_ENV=test`.\n\n## Variable expansion\n\nVariable expansion is supported by _universal-dotenv_. All identifiers in environment values prefixed by `$` (dollar sign) or surrounded by `${NAME}` are expanded. Used algorithm is:\n\n- Merge all .env files and command line environment settings into one map (see File Priority)\n- Check every environment setting for variable expansion identifiers\n- Expand variable expansion identifiers recursively\n\nSee files in `testcase/hierarchy` for an example of a complex variable expansion.\n\n## Basic Usage\n\nAll loading features are enabled by importing the core module itself and run init():\n\n```js\nimport { init } from \"universal-dotenv\"\ninit()\n```\n\nAfter this you can access all environment settings you have defined in one of your `.env` files.\n\n```js\nconsole.log(process.env.APP_MY_ENV)\n```\n\n## Automatic loading\n\nIf you don't want to control the init process you can also register an automated version:\n\n```js\nimport \"universal-dotenv/register\"\n```\n\nThis loads all environment settings on import of module.\n\n## Serialization\n\nThe module offers access to all app specific environment settings which should be prefixed with `APP_` e.g. `APP_TITLE = \"My App\"`.\n\n```js\nimport { getEnvironment } from \"universal-dotenv\"\n\n// This also loads all environment specific settings into `process.env`\n\nconst { raw, stringified, webpack } = getEnvironment()\n```\n\nReturn values:\n\n- raw: Just a plain JS object containing all app settings\n- stringified: Plain object but with JSON stringified values\n- webpack: For usage with [Webpacks Define Plugin](https://webpack.js.org/plugins/define-plugin/)\n\nWebpack Usage:\n\n```js\nimport { getEnvironment } from \"universal-dotenv\"\nconst { webpack } = getEnvironment()\n\n...\n\nplugins.push(new webpack.DefinePlugin(webpack))\n```\n\nThis method also supports custom filtering of the environment data to export using a key-based filter method.\n\nHere you can see the example config for only exporting environment settings where the key starts with string `MYKEY_`.\n\n```js\nconst { raw, stringified, webpack } = getEnvironment({\n  filter: (key) => key.startsWith(\"MYKEY_\")\n})\n```\n\nBy default the `getEnvironment()` method translates strings which look like numbers or booleans into their native type representation. To disable this behavior pass over `false` for `enableTranslation` like:\n\n```js\nconst { raw, stringified, webpack } = getEnvironment({ translate: false })\n```\n\n## License\n\n[Apache License Version 2.0, January 2004](license)\n\n## Copyright\n\n<img src=\"https://cdn.rawgit.com/sebastian-software/sebastian-software-brand/0d4ec9d6/sebastiansoftware-en.svg\" alt=\"Logo of Sebastian Software GmbH, Mainz, Germany\" width=\"460\" height=\"160\"/>\n\nCopyright 2018-2022<br/>[Sebastian Software GmbH](http://www.sebastian-software.de)\n","publish_time":1529309263699,"deprecated":"This package is no longer maintained. Please consider alternatives.","_cnpm_publish_time":1529309263699,"dist-tags":{"latest":"4.1.0"}}