{"library":"runtime-node-refresh","title":"runtime-node-refresh (RnR)","description":"runtime-node-refresh (RnR) is a lightweight JavaScript utility designed to update Node.js environment variables (`process.env`) at runtime without requiring a server restart. Currently at version 1.0.7, it appears to have an infrequent release cadence given its focused scope as a 'tiny lib'. Its core mechanism relies on Node.js signals, specifically `SIGPIPE`, to communicate between different Node.js processes, enabling one process to trigger an update in another. This differentiation allows for dynamic configuration changes in long-running applications, such as adjusting log levels or feature flags without service interruption. It's particularly useful for production environments where restarts are costly, but crucially, it does not support Worker threads due to its reliance on inter-process signals.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install runtime-node-refresh"],"cli":null},"imports":["import RnR from 'runtime-node-refresh';","npm run refresh"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/* index.js */\nimport RnR from 'runtime-node-refresh';\n\nprocess.env.LOG_LEVEL = 'error';\n\nRnR(() => {\n  process.env.LOG_LEVEL = 'debug';\n  console.log('Environment variables refreshed!');\n});\n\nsetInterval(() => console.log(`The LOG_LEVEL is set to ${process.env.LOG_LEVEL}`), 3000);\n\n/* package.json (relevant scripts and dependencies) */\n{\n  \"name\": \"test-rnr\",\n  \"scripts\": {\n    \"start\": \"node index.js\",\n    \"refresh\": \"runtime-node-refresh\"\n  },\n  \"dependencies\": {\n    \"runtime-node-refresh\": \"^1.0.7\"\n  }\n}\n\n// To run:\n// Terminal 1: npm start\n// Terminal 2: npm run refresh\n","lang":"javascript","description":"This quickstart demonstrates how to initialize `runtime-node-refresh` in a Node.js application and then trigger an environment variable update from a separate process using the `runtime-node-refresh` CLI tool.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}