{"_id":"template2env","_rev":"8-5fa7588aa12657c32ad999f18b3cbb48","name":"template2env","time":{"modified":"2022-06-27T04:41:28.488Z","created":"2016-01-30T22:03:13.206Z","1.0.0":"2016-01-30T22:03:13.206Z","1.0.1":"2016-01-30T22:07:51.660Z","1.0.2":"2016-02-01T22:40:04.718Z","1.0.3":"2016-02-01T22:42:31.730Z","1.0.4":"2016-02-02T19:55:04.745Z"},"maintainers":[{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"}],"dist-tags":{"latest":"1.0.4"},"description":"A micro dependency that interpolates environment variables","readme":"# template2env\nA micro dependency that interpolates environment variables\n\n## Description\ntemplate2env is a single function that accepts a string (and an optional object of options) as a parameter and returns an interpolated string with varaibles replaced by matching environment variables (located in `process.env`).\n\nIt will throw if a matching variable is not found in `process.env` and will return the string that was passed if nothing was found to interpolate.\n\n## Use case\nImagine a projects configuration is stored in JSON or YAML and you want one configuration file for all your environments.\n\n```yaml\n# config.yaml\nsite: my site\nhost: ${HOST}\nport: ${PORT}\n```\n\nIf `process.env` contains `HOST` and `PORT` template2env will intrpolate the yaml and return the matching values, so your local development environment could look like\n```yaml\n# local dev environment\n# export HOST=\"localhost\"\n# export PORT=8888\nsite: my site\nhost: localhost\nport: 8888\n```\n\nBut your production environment could look like\n\n```yaml\n# production environment\n# export HOST=\"foo.biz\"\n# export PORT=3001\nsite: my site\nhost: foo.biz\nport: 3001\n```\n\n## How to use\n```javascript\nvar template2env = require('template2env'),\n  fs = require('fs');\n\nfs.readFile('config.yaml', function (err, data) {\n  if (err) throw err;\n  console.log(template2env(data));\n});\n```\n\n## Options\ntemplate2env accepts an object of options as an optional second paramter\n`start {string} ('${')` - start token for interpolation\n`end {string} ('}')` - end token\n\n### Example\n```javascript\n/* if config.yaml uses `{{VARIABLE}}` for interpolation */\n\nvar template2env = require('template2env'),\n  fs = require('fs');\n\nfs.readFile('config.yaml', function (err, data) {\n  if (err) throw err;\n  console.log(template2env(data, { start: '{{', end: '}}' }));\n});\n","versions":{"1.0.1":{"name":"template2env","version":"1.0.1","description":"A micro dependency that interpolates environment variables","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ughitsaaron/template2env.git"},"scripts":{"test":"mocha --reporter=dot"},"keywords":["string","replace","bash","environment","env","configuration","config","utility"],"author":{"name":"Aaron Petcoff","email":"hello@aaronpetcoff.me","url":"http://aaronpetcoff.me"},"license":"ISC","devDependencies":{"mocha":"^2.4.5"},"gitHead":"7f1593c54e01912ae44f2868e46e0bb8140350fc","bugs":{"url":"https://github.com/ughitsaaron/template2env/issues"},"homepage":"https://github.com/ughitsaaron/template2env#readme","_id":"template2env@1.0.1","_shasum":"766e2d09b6967781204fd9bdf204f0b536144ac4","_from":".","_npmVersion":"3.5.0","_nodeVersion":"4.2.3","_npmUser":{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"},"dist":{"shasum":"766e2d09b6967781204fd9bdf204f0b536144ac4","tarball":"https://registry.npmjs.org/template2env/-/template2env-1.0.1.tgz","integrity":"sha512-xAiK8BPOZ9+EUcQQymDD3u/afBv956M7tnWKEoGnEAXkq8Q6188ajD5qB+ehAlahN7RmGx7HUbWgS5fS+Le/cw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmSJ8FvEP0qtjMP2tkcQmmjd8gCpWtrLHxVOpRivUwrAIgbiMfLAQeYONNTwwPbkqCKf6Zebnjatl8/BgyWwFkUT0="}]},"maintainers":[{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"}]},"1.0.2":{"name":"template2env","version":"1.0.2","description":"A micro dependency that interpolates environment variables","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ughitsaaron/template2env.git"},"scripts":{"test":"mocha --reporter=dot"},"keywords":["string","replace","bash","environment","env","configuration","config","utility"],"author":{"name":"Aaron Petcoff","email":"hello@aaronpetcoff.me","url":"http://aaronpetcoff.me"},"license":"ISC","devDependencies":{"mocha":"^2.4.5"},"gitHead":"0212294c47de409dad5ed6a160d2ecbcbb469b73","bugs":{"url":"https://github.com/ughitsaaron/template2env/issues"},"homepage":"https://github.com/ughitsaaron/template2env#readme","_id":"template2env@1.0.2","_shasum":"13d3d99ea3ab950efc84575a4e39b08f10827155","_from":".","_npmVersion":"3.5.0","_nodeVersion":"4.2.3","_npmUser":{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"},"dist":{"shasum":"13d3d99ea3ab950efc84575a4e39b08f10827155","tarball":"https://registry.npmjs.org/template2env/-/template2env-1.0.2.tgz","integrity":"sha512-KlJw9nFVFi1tdaxXr0B9XWaP9dcZrBAxpDebY0Mk+02+WI5K5LXSUcD+RJfossl/M6XOhdjmnhSqgPctRZ6Fuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWzBhq/StQy4mzn0kuHNLPp33VMmpC4qVqWwpFHWe/1gIgcxpR3MsucPgVllOKRuD7ACoy2JAr1lU/Smi4DJIdl6M="}]},"maintainers":[{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/template2env-1.0.2.tgz_1454366402233_0.629500592360273"}},"1.0.3":{"name":"template2env","version":"1.0.3","description":"A micro dependency that interpolates environment variables","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ughitsaaron/template2env.git"},"scripts":{"test":"mocha --reporter=dot"},"keywords":["string","replace","bash","environment","env","configuration","config","utility"],"author":{"name":"Aaron Petcoff","email":"hello@aaronpetcoff.me","url":"http://aaronpetcoff.me"},"license":"MIT","devDependencies":{"mocha":"^2.4.5"},"gitHead":"60b7bf65b6a159a7bdc938d0c2a515b4285ce37a","bugs":{"url":"https://github.com/ughitsaaron/template2env/issues"},"homepage":"https://github.com/ughitsaaron/template2env#readme","_id":"template2env@1.0.3","_shasum":"b348b567e046dfaa19956b400725cc89385ce103","_from":".","_npmVersion":"3.5.0","_nodeVersion":"4.2.3","_npmUser":{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"},"dist":{"shasum":"b348b567e046dfaa19956b400725cc89385ce103","tarball":"https://registry.npmjs.org/template2env/-/template2env-1.0.3.tgz","integrity":"sha512-sxSWWkMxglOr4WB5y4Ag6bPsHzGPoEjgl8Fjx7TazETNE7v1eoeY21eZaqOaQJcRKDRcnFscdYEBH2hOmSH8kw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBDVXEy19UnnLsnRxzY7jSw/CQ95kukJO0zaEkarqlUOAiEAr5FcSlPJc+ZgEfQSHxS6RZJqWhf4yAsTFsKQmDghiZU="}]},"maintainers":[{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/template2env-1.0.3.tgz_1454366550689_0.9052652814425528"}},"1.0.4":{"name":"template2env","version":"1.0.4","description":"A micro dependency that interpolates environment variables","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ughitsaaron/template2env.git"},"scripts":{"test":"mocha --reporter=dot"},"keywords":["string","replace","bash","environment","env","configuration","config","utility"],"author":{"name":"Aaron Petcoff","email":"hello@aaronpetcoff.me","url":"http://aaronpetcoff.me"},"license":"MIT","devDependencies":{"mocha":"^2.4.5"},"gitHead":"3dd96c4843cbd94be128ea4927f6d0d7e43d4c47","bugs":{"url":"https://github.com/ughitsaaron/template2env/issues"},"homepage":"https://github.com/ughitsaaron/template2env#readme","_id":"template2env@1.0.4","_shasum":"bc6c5647b793dd860e69f4c333b6e6b1a28bef40","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.2.0","_npmUser":{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"},"dist":{"shasum":"bc6c5647b793dd860e69f4c333b6e6b1a28bef40","tarball":"https://registry.npmjs.org/template2env/-/template2env-1.0.4.tgz","integrity":"sha512-mjG0HGWVda6ThmmsZLgmCuLNUbPY4/jUu2W/JOI8pJSvkNLGeTqTGNPUCNBe8/DQfJNbN3i4WKWhqI1ojRcssg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHW9c4FGY1rb/an8QKsqFMBbmHzzzNQTTD4Z/LrCFKVmAiB+KpqJUz3APNU6dmdAGUIqcN5olL4zRaBQNSv20f+aGw=="}]},"maintainers":[{"name":"ughitsaaron","email":"hello@aaronpetcoff.me"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/template2env-1.0.4.tgz_1454442902296_0.14643528778105974"}}},"homepage":"https://github.com/ughitsaaron/template2env#readme","keywords":["string","replace","bash","environment","env","configuration","config","utility"],"repository":{"type":"git","url":"git+https://github.com/ughitsaaron/template2env.git"},"author":{"name":"Aaron Petcoff","email":"hello@aaronpetcoff.me","url":"http://aaronpetcoff.me"},"bugs":{"url":"https://github.com/ughitsaaron/template2env/issues"},"license":"MIT","readmeFilename":"README.md"}