{"_id":"middy-env","_rev":"2-a0e8a26e07a4e1529650051d38a54224","name":"middy-env","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"middy-env","version":"1.0.0","description":"Environment variable middleware for the middy framework","main":"index.js","scripts":{"test":"jest","lint":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/chrisandrews7/middy-env.git"},"keywords":["middy","middleware","lambda","env","config","env","var","environment","environment","variable"],"author":{"name":"Chris Andrews"},"license":"MIT","bugs":{"url":"https://github.com/chrisandrews7/middy-env/issues"},"homepage":"https://github.com/chrisandrews7/middy-env#readme","devDependencies":{"coveralls":"^3.0.4","eslint":"^5.16.0","eslint-config-airbnb-base":"^13.1.0","eslint-plugin-import":"^2.17.3","jest":"^24.8.0","middy":"^0.25.1"},"gitHead":"85fe29ef06ac00f0ee5774736147b39ae1c561e5","_id":"middy-env@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.2","_npmUser":{"name":"chrisandrews7","email":"chris@straza.co.uk"},"dist":{"integrity":"sha512-q3bMDBASFmcXT50Oh6TZkjQqiRMX79aSHHlZXAY7Fge257ZyXrsi9JfvFSWnHDTFiC+bMAByp8RzR064cMVh6Q==","shasum":"ee0bbd61b86ab41748643fa7cc525ff1c7d21215","tarball":"https://registry.npmjs.org/middy-env/-/middy-env-1.0.0.tgz","fileCount":9,"unpackedSize":12155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdALbPCRA9TVsSAnZWagAA1RsP/RYTRLulHNgbjg00AEgJ\nVdwSkMx6gsYN+WItzYczYJHxYoyzSnR777KLWORwq0jYSiqTAakb+fIhl5KF\n/yIMVCHD806kdTefc8KLJs5lNonbQpgQKxAgR2J9Hf07tjkkqMWp3I9X752B\nhGfO7jeFlelKZqqlXD9yX1qZQA+2WzKeqdR9EOJ5kFnjYj9KSiPiCHqQ6MbY\nAiRgakwl3FtovTzhXsK1s+STfNXDzRk8KnzojeJxjuBZxzjhL2e0iIvIW6sy\nWdX9paGPqWsvafT0C9iLjoupFVZzhwzwZo88T7j0BNVaXSmvvlKycCvGqRt8\n8MeEumMyJN9TncYdn3Wyi4Upqsw6mFrFOsnK5sCQOMmM1hiZ6Huogq6MhVd2\nvVtTK7rbfn7OK4o5rndWbTvHpPsyX+rmIEgJAGH0C82SoV9G9k2iUs9HF1vc\nTj3KQc3/86pT9NSJ9lJGUMmtPYJqayb/APqKVyMuwgn9psoK1xt+v2m7qd54\no03EivKONQMxdMq56UaYstSsb/1qlbewJeiiqq26veqqmiui4dW/ttCQC0M0\nQE8of39MvKsfUSSIGouq182V5vZMelKPYz4TNaD5dl9Xx1HmmnQIKMvRavoE\nVkPWivcFJPap60B2rw+apnhcBiWpIMApK8To+3EKQhFHXFYi43ldItd+shzY\n0b83\r\n=YhtN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFNdLxPS5hczyc919vfeielooOevFn3szNTyAAL/HJxFAiEA64sANy/u+z27xQ75IEAmy8Ek8PfJ3Szs400Xq7MqyfQ="}]},"maintainers":[{"name":"chrisandrews7","email":"chris@straza.co.uk"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middy-env_1.0.0_1560327886667_0.5466593934104904"},"_hasShrinkwrap":false},"2.0.0":{"name":"middy-env","version":"2.0.0","description":"Environment variable middleware for the middy framework","main":"index.js","scripts":{"test":"jest","lint":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/chrisandrews7/middy-env.git"},"keywords":["middy","middleware","lambda","env","config","env","var","environment","environment","variable"],"author":{"name":"Chris Andrews"},"license":"MIT","bugs":{"url":"https://github.com/chrisandrews7/middy-env/issues"},"homepage":"https://github.com/chrisandrews7/middy-env#readme","devDependencies":{"@middy/core":"^2.5.0","@middy/core-v1":"npm:@middy/core@^1.5.2","coveralls":"^3.0.4","eslint":"^5.16.0","eslint-config-airbnb-base":"^13.1.0","eslint-plugin-import":"^2.17.3","jest":"^27.0.6"},"gitHead":"eb99036eb765331ae6a2bfa29db0fb70fed87093","_id":"middy-env@2.0.0","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-JFYgLEymGDM4dAhqEliuLDUykRugEUq57Pac1fuF5iC1LsbvJlXhMkxZZFzT4pM4iZhLea7XSmQO2O+kB+uAxA==","shasum":"65ab2454c5629e54f43a837ecaccf4c87fe85d86","tarball":"https://registry.npmjs.org/middy-env/-/middy-env-2.0.0.tgz","fileCount":10,"unpackedSize":12822,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOnWaCRA9TVsSAnZWagAAQ6IP/1rs151gdoDxOG0yIzp5\n8B3lYiZKY3wHFs6I1qDxZYY+SvNtzuy/sT+HAix2FSlUYnyCDwwz8SjXip2D\ns94Rcet13E6oN52VFHJFS7qcJm/N5MtgqU4jbesOrWiUm4RgdYuUhKBnjpMS\nEIHPh5Firq68xltatSOnUX+s3qRC156Zg+OKYyOLzxx4+tUSfIe5n32ohimt\nok/wX6SilunSnGIBCFvz7OK65UiyBfE8z8m1L7zWATYCF85tlZFYSlqmftN0\nsD482WN2a9sXifJsfR0SHOWlNJ1M/EhX5JFzgtxlJJzNUH+FfSV38k18kZJz\nBsLTlH2YuF7vja2P0nbJrafSAYRAaBendCzivp+g4pb5FYfY95fbbfZaL/wx\na98Z4WP6jRIA2VmlQ9D4oj1dNuuFN/FDIsh8pIOQpiOzBTsNy5fb1UO42qtL\n+Rlg7aVoT5igKsJ6xBTAZ0Qtiitx6RIy5V97i96jnoR0SpWi7zX7ial4Kcsv\nm7If6okOfz7hvMo91qZbR5e7slMcPjkg/jP+OekwzCm60atyGfpbFT238RxS\nj+5DXaQZ8qseTzxZN95eE25JOFJiWoUnIGYtzl+UhOnejQWJD0XntKKdIf36\nygOnwt8/M+hefa2D9CRzBhU7kp5QNMrc82UWLTBf8qx1zO+O1bS/8mdKRnBH\nljbg\r\n=dkVo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5cdeDeZlDmTdBzIO2y7YmxO5vrgh4wFRb6J/VgmrJMAiAaPL75l00TQxs7yEU5CVgU6NtGl/GeaTFw+llxwQn/GQ=="}]},"_npmUser":{"name":"chrisandrews7","email":"chris@straza.co.uk"},"directories":{},"maintainers":[{"name":"chrisandrews7","email":"chris@straza.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middy-env_2.0.0_1631221146707_0.7292187256692555"},"_hasShrinkwrap":false}},"time":{"created":"2019-06-12T08:24:46.666Z","1.0.0":"2019-06-12T08:24:46.818Z","modified":"2022-05-09T08:02:20.741Z","2.0.0":"2021-09-09T20:59:06.854Z"},"maintainers":[{"name":"chrisandrews7","email":"chris@straza.co.uk"}],"description":"Environment variable middleware for the middy framework","homepage":"https://github.com/chrisandrews7/middy-env#readme","keywords":["middy","middleware","lambda","env","config","env","var","environment","environment","variable"],"repository":{"type":"git","url":"git+https://github.com/chrisandrews7/middy-env.git"},"author":{"name":"Chris Andrews"},"bugs":{"url":"https://github.com/chrisandrews7/middy-env/issues"},"license":"MIT","readme":"# Middy Env\n\nEnvironment variable middleware for the [middy](https://github.com/middyjs/middy) framework\n\n[![npm version](https://img.shields.io/npm/v/middy-env.svg?style=flat)](https://www.npmjs.com/package/middy-env)\n\n## Install\n\n```bash\nnpm install middy-env\n```\n\nThe specified environment variables will be parsed and passed into the handler. \n\n## Options\n\n- `cache` (boolean) (optional): Set it to `true` to skip further lookups of environment variables. Defaults to `false`.\n- `cacheExpiryInMillis` (int) (optional): Time in milliseconds for values to remain cached. Defaults to `undefined`.\n- `setToContext` (boolean) (optional): This will assign the parsed values to the `context` object\n  of the function handler rather than to `process.env`. Defaults to `true`.\n- `names` (object) (required): Map of environment variables to parse, where the key is the destination.  \nEither provide just the environment variable key. Or provide the key, type and fallback value e.g. `['KEY', 'string', 'fallbackValue']`.\n\nBy default parameters are assigned to the function handler's `context` object. They can instead be assigned to the Node.js `process.env` object by setting the `setToContext` flag to `false`.   \nIf no fallback value is provided a [ReferenceError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) will be thrown if an environment variable is undefined.\n\n## Supported Types\n- `string`\n- `int`\n- `float`\n- `bool`\n\n## Usage\n\n```js\nconst middy = require('middy');\nconst env = require('middy-env');\n\nconst handler = (event, context, callback) => {\n  callback(null, `Hello ${context.firstName} ${context.lastName}`);\n};\n\nmodule.exports = middy(handler)\n  .use(env({ \n    names: {\n      firstName: ['FIRST_NAME', 'string', 'World'],\n      lastName: 'LAST_NAME'\n    },\n    cache: true,\n    cacheExpiryInMillis: 3600000\n  }));\n```","readmeFilename":"README.md"}