{"_id":"@ankurthakurdelhi/config-helper","name":"@ankurthakurdelhi/config-helper","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ankurthakurdelhi/config-helper","version":"1.0.0","description":"Helper for loading Configuration as a singleton and use it dynamically in the application without reloading the application. It currently support loading the Configuration from a Local JS/JSON file or through HTTP(S) URL. It support Expiry, thus, it reloa","main":"index.js","dependencies":{"object-path":"^0.11.8","request":"^2.88.2"},"devDependencies":{},"scripts":{"test":"node index.js"},"keywords":["dynamic","configuration","config","helper","cache","expiry","reload"],"author":{"name":"Ankur Thakur"},"license":"ISC","repository":{"type":"git","url":"https://gitlab.com/redgirraffe/public/config-helper.git"},"gitHead":"82cea203e60e90b9611ceb7713713eee5f4645ee","_id":"@ankurthakurdelhi/config-helper@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"ankurthakurdelhi","email":"thakurboyz2007@gmail.com"},"dist":{"integrity":"sha512-7+UzxJh2M8fXRVwKukD/nlmLzo3qQNZPGOE+E1OicF9fsuLdXGg4n3vLuCQnIn4OYYQXp6dae5T5GQrmwkSigw==","shasum":"57d7de9ae0fc96ba8f39217d71c85c87725154c3","tarball":"https://registry.npmjs.org/@ankurthakurdelhi/config-helper/-/config-helper-1.0.0.tgz","fileCount":3,"unpackedSize":4095,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICnH/kTmSbbNZg/hZqIA3ZVTeGu5ut/V+x0Qnqix7GJdAiAf4T2d2fZB/jUTGa4Qyk8L7MOpdnhIjNcnMiyDSxL/Zw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvTeFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp65g/+LfIW23zC6KsJiUu1gdMYEx5XHXI4E6YgE/WFoq1jaOcQb5Kj\r\n1FJSCbZAYHz9n2zHtAnWJqN8IFwSD99QJ5Az2udkoSLjPYS6bWg9GiSD3qXS\r\n8kejcK5XwYIvJmc6PJ6h6c8sbFqRqFKEiQZt5fhcf0MJ9R0Jmpq8SUrGpuzA\r\n47oGi5WyjSp8k0OzCAr58+GniFKiVrk4Tzs5TuS95fJ8yLXX4ENjp/6SWAJ1\r\nlECiO4yiq/LLWIUAHPrXSVwtStKZCR01jTYvEejxo5aO82/fGt/GdZl/lkJl\r\n2C/7XJ4c3HKAAJv7Z8Yw7aXJyMC/2KW8Dylw7J78E5TYdhD+FdNbjZOsQ9/5\r\nJm4qoj8CTESczJEGaQ8YTLLroGd29OrCvm336flIT+53Oklz3uWBhZGlgTNy\r\nlyG6gUQxENNaiTfjdHkOKSEBs6755W3K4t4KwLF7jQK9rfqRVhdtDoU8pQtA\r\n+HP0rD99di5J9E/XcJfIk2qAzfFhIar5VOJTzfl/abEBz/odKX/VmAlFx7yJ\r\nSBWSDSiOW2sln0j7hM4vkO/3d8MnovahTY7NL0Jho/PlKOMnStVH90mMkAB6\r\nWJSDNLoC59gyIyeIKBmeyrNGgQXdshha7FAh71+sNj/7UQUQttevu8dDGGi7\r\nbhTevcVcJpOriNzRzsfldT9Dy5j9Zg11w6I=\r\n=+SPq\r\n-----END PGP SIGNATURE-----\r\n"},"directories":{},"maintainers":[{"name":"ankurthakurdelhi","email":"thakurboyz2007@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/config-helper_1.0.0_1673344901642_0.4983591258985147"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-10T10:01:41.577Z","1.0.0":"2023-01-10T10:01:41.798Z","modified":"2023-01-10T10:01:41.926Z"},"maintainers":[{"name":"ankurthakurdelhi","email":"thakurboyz2007@gmail.com"}],"description":"Helper for loading Configuration as a singleton and use it dynamically in the application without reloading the application. It currently support loading the Configuration from a Local JS/JSON file or through HTTP(S) URL. It support Expiry, thus, it reloa","keywords":["dynamic","configuration","config","helper","cache","expiry","reload"],"repository":{"type":"git","url":"https://gitlab.com/redgirraffe/public/config-helper.git"},"author":{"name":"Ankur Thakur"},"license":"ISC","readme":"Helper for loading Configuration as a singleton and use it dynamically in the application without reloading the application. It currently support loading the Configuration from a Local JS/JSON file or through HTTP(S) URL. It support Expiry, thus, it reloads the Config internally after the given expiry.\n\n# Introduction\n\nWe wanted a way using which we can change the Configuration of a certain environment without reloading the whole NodeJS application. Adding to this, we wanted to load the Configuration from a Remote Application (e.g. [Strapi CMS](https://strapi.io/)) so that it can be updated remotely whenever required and without reloading the whole application.\n\n# Usage\n\n```js\nvar configHelper = require(\"config-helper\");\n\n// Loading a Relative Config file with Expiry of 4 seconds\nvar configLocal = configHelper(\"./myconfig.json\", 4000);\n\n// Loading an Absolute Config file with Expiry of 10 seconds\nvar configAnotherLocal = configHelper(\"/opt/some/place/on/earth/config.js\", 10000);\n\n// Loading an Absolute Config file with Expiry of 30 seconds\nvar configRemote = configHelper(\"https://someurl/which/returns/JSON\", 30000);\n\n// Using it\n/* Assuming that we get the below Object as Config:\n{ \"name\": \"Scorpio-N\", \"data\": { \"petrol\": false, \"4wd\": true } }\n*/\nconsole.log(\"Full Configuration Object\", config());\n// returns { \"name\": \"Scorpio-N\", \"data\": { \"petrol\": false, \"4wd\": true } }\n\nconsole.log(\"Vehicle Name\", config(\"name\"));\n// returns \"Scorpio-N\"\n\nconsole.log(\"Is Vehicle 4x4 ?\", config(\"data.4wd\"));\n// returns true\n```\n","readmeFilename":"README.md"}