{"_id":"envconf","_rev":"18-ee2066a936d07a98971bcc9bee97596d","name":"envconf","description":"a module for express-style programmatic configuration","dist-tags":{"latest":"1.1.0"},"versions":{"0.0.1":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"0.0.1","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1.9.0","should":"~1.2.2","sinon":"*","jshint":"*"},"homepage":"https://github.com/WindowsAzure/envconf","repository":{"type":"git","url":"git@github.com:WindowsAzure/envconf.git"},"bugs":{"url":"http://github.com/WindowsAzure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@0.0.1","dist":{"shasum":"bd87231c9ce4c63a1852351073e6ca011102f665","tarball":"https://registry.npmjs.org/envconf/-/envconf-0.0.1.tgz","integrity":"sha512-u8vLTteKdxf3rgSTMAiVcTZTbq2UmeSMi2lKERiRk3UFScMXtSvMW/OMTJ5C6SVvuGNlP8H4PwjHp1JKACLQ+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEWF7DIJwi8b9Rpsilkq3ilnWUikujIcQWQkhIDAWcEvAiBKHdveKaa4doQnAbyyovLHiL2Bx4bTCwZZ8TvvDhZuAg=="}]},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}]},"0.0.2":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"0.0.2","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1.9.0","should":"~1.2.2","sinon":"*","jshint":"*"},"homepage":"https://github.com/WindowsAzure/envconf","repository":{"type":"git","url":"git@github.com:WindowsAzure/envconf.git"},"bugs":{"url":"http://github.com/WindowsAzure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@0.0.2","dist":{"shasum":"bdff02d232ea2c0e68754355ad7946dae566821a","tarball":"https://registry.npmjs.org/envconf/-/envconf-0.0.2.tgz","integrity":"sha512-yl59GppfIHI2B6VISI4p4Lol/pSM1Gckx17zvhqF26DdnucquW5mriC0t8W5VHjok2AEKZGeyYJGLGB5RAyznw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDeXbZQ0CiN0wWg3sba+d9xNTdJd8MjywEC/UHGaW+1wgIgS9rJ2UKfUtyjXsbVqKNU60ndzkIzXpC35ZcD8VbAd1M="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}]},"0.0.3":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"0.0.3","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1.9.0","should":"~1.2.2","sinon":"*","jshint":"*"},"homepage":"https://github.com/WindowsAzure/envconf","repository":{"type":"git","url":"git@github.com:WindowsAzure/envconf.git"},"bugs":{"url":"http://github.com/WindowsAzure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@0.0.3","dist":{"shasum":"451cbac616d1cebaee50bf94e6183d05334265cd","tarball":"https://registry.npmjs.org/envconf/-/envconf-0.0.3.tgz","integrity":"sha512-WseKzhsO0lvU3vuxsDwX2D+7xbimMLW6d/6PAMksz+EfNxe5QneRRP0p73gZ/nRQ/mAyVwaj1PtFe2e7pOMXZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHStVZBatEe27hd5rMfHMqwnEJ6GTPeF+hWAZplilybsAiEA4d/aND0azS/xa3oqkvrCzxEkc5niJH5+IKBA1xqmW/Q="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}]},"0.0.4":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"0.0.4","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1.12.0","should":"~1.2.2","sinon":"*","jshint":"*"},"homepage":"https://github.com/WindowsAzure/envconf","repository":{"type":"git","url":"git@github.com:WindowsAzure/envconf.git"},"bugs":{"url":"http://github.com/WindowsAzure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@0.0.4","dist":{"shasum":"85675afba237c43f98de2d46adc0e532a4dcf48b","tarball":"https://registry.npmjs.org/envconf/-/envconf-0.0.4.tgz","integrity":"sha512-2m1iNXPrvG5FNoBEsYm8HTcsS5lViCZsRcLiuBZsOPX9G09bzv9+yo9Xp6ih8HSG3Mqhcd4M0n7sSD/QgY05Xg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF3KQvDjfDWV6RL+7Fs/BZ8Dff6C3NvB6dHhw2KOJj88AiBm/x5gpNngbjb+ReiRME5q+3DgdI7KmMyEVaEhpVkQDQ=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}]},"1.0.0":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"1.0.0","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1","should":"~3","sinon":"*","jshint":"*"},"homepage":"https://github.com/Azure/envconf","repository":{"type":"git","url":"git@github.com:Azure/envconf.git"},"bugs":{"url":"http://github.com/Azure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@1.0.0","_shasum":"2a8035840b674887f51c9a4edb974bdbe1ab5392","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}],"dist":{"shasum":"2a8035840b674887f51c9a4edb974bdbe1ab5392","tarball":"https://registry.npmjs.org/envconf/-/envconf-1.0.0.tgz","integrity":"sha512-rR7yrbsULF8dRkLyZNGwMgR57C0CwjPi89QAgqTa/iqjk1ifwaIt2bMYwaSxIuVI61S3V5nD/mGEpKwMVuHHEA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCa4eyQ846CAx27OPoa5ZJrJ4H6Vn/33KYNbVU8A0ee3gIgV7AwWJc8PRDaZIAFrzVxhtJXpSxFYjW/9o9uONs5EK4="}]}},"1.1.0":{"name":"envconf","author":{"name":"Microsoft Corporation"},"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"version":"1.1.0","description":"a module for express-style programmatic configuration","main":"lib/index.js","tags":["config","environment"],"keywords":["config","configuration","environment"],"licenses":[{"type":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"mocha":"~1","should":"~3","sinon":"*","jshint":"*"},"homepage":"https://github.com/Azure/envconf","repository":{"type":"git","url":"git@github.com:Azure/envconf.git"},"bugs":{"url":"http://github.com/Azure/envconf/issues"},"scripts":{"test":"npm -s run-script jshint && npm -s run-script unit","unit":"mocha -R spec","jshint":"jshint lib"},"_id":"envconf@1.1.0","dist":{"shasum":"80f7d14f3a34e0fd8a9656dbbfa3a3d9bca54d7c","tarball":"https://registry.npmjs.org/envconf/-/envconf-1.1.0.tgz","integrity":"sha512-Rr7g2wYn5zJc6+DwpAXB9vyZ3y9RvYSh9ZNncwzFRVRUiogKLEvHbiSl07cMzjXI8FDbO23dHLffIX4X8I4HFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFZoGzTfl5PS90Jim5OAQHjk59pmyu3DzevpSNV+RgqLAiAdwhjfTiVMh9xAUzdgOXzV5iXTv0dED20HgLQtSx+2xQ=="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ctavares","email":"ctavares@microsoft.com"},"maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}]}},"readme":"envconf\n===========\n\nThis module makes it easy to use express-style configuration for any application.\nIt allows your users to define separate configuration environments in code\nand switch between sets of configuration via a single environment variable.\n\n## Basic Usage\n\n```javascript\n\nvar envconf = require('envconf');\n\nvar c = envconf.createConfig();\n\nc.configure('development', function (c) {\n  c.set('settingOne', 'devValue');\n});\n\nc.configure('production', function (c) {\n  // You can also pass in an object literal to set a bunch\n  // of values at once\n  c.set({\n    settingTwo: 'prodValue'\n    prodOnly: 'prodSpecific'\n  });\n});\n\nc('development').get('settingOne').should.equal('devValue');\n\nprocess.env.NODE_ENV = 'production';\nc.default.get('settingTwo').should.equal('prodValue');\nc.default.get('prodOnly').should.equal('prodSpecific');\n```\n\nThe previous code shows picking up the default environment from the NODE_ENV environment variable.\n\nYou can however configure your own environment variables as shown below.\n\n```javascript\n\nvar c2 = envconf.createConfig({ defaultEnvVar: 'MY_LIBRARY_VAR'});\n\nc2.configure('development', function (c) {\n  c.set('settingOne', 'devValue');\n});\n\nc2.configure('production', function (c) {\n  c.set('settingTwo', 'prodValue');\n});\n\nc2('development').get('settingOne').should.equal('devValue');\n\nprocess.env.MY_LIBRARY_VAR = 'production';\nc.default.get('settingTwo').should.equal('prodValue');\n```\n\n## Setting Getters\n\nInstead of a setting a simple value, you can instead use the setFunc method to\nprovide a function that will run when the value is requested:\n\n```javascript\nvar c2 = envconf.createConfig();\n\nc2.configure('development', function (c) {\n  c.setFunc('settingOne', function () { return 'This value came from a function'; });\n});\n\nc2.get('settingOne').should.equal('This value came from a function');\n```\n\nor, if you use the object literal version of set, values that are functions\nwill be treated as if you called setFunc for that value:\n\n```javascript\nvar c2 = envconf.createConfig();\n\nc2.configure('development', function (c) {\n  c.set({\n    settingOne: function () { return 'This value also came from a function'; }\n  });\n});\n\nc2.get('settingOne').should.equal('This value also came from a function');\n```\n\nThis can be handy if you want to have a default value that you need to derive from\nambient state.\n\n## Customizing the config object\n\nDo you want to add helper methods for your specific configuration? Or set specific\nvalues in every configuration? It's easy with a config customizer:\n\n```javascript\n\nfunction addConfigHelpers(config) {\n  config.useSql = function (host, db) {\n    config.set('sql host', host);\n    config.set('sql database name', db);\n  }\n}\n\nvar c3 = envconf.createConfig( { customizer: addConfigHelpers });\n\nc3.configure('test', function (c) {\n  c.useSql('testmachine', 'testdb');\n});\n\nc3.configure('production', function (c) {\n  c.useSql('realDatabase', 'actualDb');\n});\n\n// Can also customize after creation, customizations\n// will affect any child configs too!\nc3 = envconf.createConfig();\nvar prod = c3('prod');\n\nc3.customize(addConfigHelpers);\n\nc3.configure('production', function (c) {\n  c.useSql('realDatabase', 'actualDb');\n});\n```\n\n\n## Saving and Restoring config values\n\nAre you making changes to a global configuration in your unit tests, and want\nto ensure you've restored the state after your test? Use a snapshot:\n\n```javascript\n\nvar c4 = envconf.createConfig();\nc4.configure(function (c) {\n  c.set('originalValue', 'one');\n});\n\n// set up contents of c4\n\nvar snapshot = c4.snapshot();\n\nc4.configure(function (c) {\n  c.set('originalValue', 'two');\n});\n\nc4.restore(snapshot);\n\nc4.get('originalValue').should.equal('one');\n```\n\nSnapshot/restore also saves and restores any child configurations.\n\n## Temporary Configs\n\nSimilarly, you might want to set up a configuration and then be able\nto throw it away without giving it a name. Easy:\n\n```javascript\n\nvar c5 = envconf.createConfig();\nc5.configure(function (c) {\n  c.set('originalValue', 'one');\n});\n\nvar c6 = envconf.tempConfig();\nc6.set('tempValue', 'temp');\n\n// You can look up values in the temp config or the parent\nc6.get('tempValue').should.equal('temp');\nc6.get('originalValue').should.equal('one');\n\n// But the parent has no record of the temp\nc5.environments.length.should.equal(0);\n```\n","maintainers":[{"name":"ctavares","email":"ctavares@microsoft.com"}],"time":{"modified":"2022-06-17T06:35:54.940Z","created":"2013-06-14T17:19:38.637Z","0.0.1":"2013-06-14T17:19:39.989Z","0.0.2":"2013-07-09T16:18:42.238Z","0.0.3":"2013-07-25T22:09:21.861Z","0.0.4":"2013-07-26T20:25:49.694Z","1.0.0":"2014-05-02T23:54:10.294Z","1.1.0":"2014-05-23T18:10:04.393Z"},"author":{"name":"Microsoft Corporation"},"repository":{"type":"git","url":"git@github.com:Azure/envconf.git"},"homepage":"https://github.com/Azure/envconf","keywords":["config","configuration","environment"],"contributors":[{"name":"Block, Glenn","email":"gblock@microsoft.com"},{"name":"Rodrigues, Andre","email":"andrerod@microsoft.com"},{"name":"Tavares, Chris","email":"ctavares@microsoft.com"}],"bugs":{"url":"http://github.com/Azure/envconf/issues"},"readmeFilename":"README.md"}