{"id":15590628,"url":"https://github.com/przemek-nowicki/runtime-node-refresh","last_synced_at":"2025-10-24T22:35:39.102Z","repository":{"id":53763523,"uuid":"488587390","full_name":"przemek-nowicki/runtime-node-refresh","owner":"przemek-nowicki","description":"Tiny lib to refresh node setup on runtime without restarting the node server.","archived":false,"fork":false,"pushed_at":"2022-12-18T10:35:46.000Z","size":13,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T05:35:33.936Z","etag":null,"topics":["env-update","node-env","node-envs-update","nodejs","nodejs-refresh","nodejs-refresh-env","refresh","runtime"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/przemek-nowicki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-04T12:52:39.000Z","updated_at":"2024-09-03T06:27:33.000Z","dependencies_parsed_at":"2023-01-29T19:02:45.454Z","dependency_job_id":null,"html_url":"https://github.com/przemek-nowicki/runtime-node-refresh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/przemek-nowicki%2Fruntime-node-refresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/przemek-nowicki%2Fruntime-node-refresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/przemek-nowicki%2Fruntime-node-refresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/przemek-nowicki%2Fruntime-node-refresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/przemek-nowicki","download_url":"https://codeload.github.com/przemek-nowicki/runtime-node-refresh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250572662,"owners_count":21452334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["env-update","node-env","node-envs-update","nodejs","nodejs-refresh","nodejs-refresh-env","refresh","runtime"],"created_at":"2024-10-02T23:23:18.335Z","updated_at":"2025-10-24T22:35:34.051Z","avatar_url":"https://github.com/przemek-nowicki.png","language":"JavaScript","readme":"# RnR - runtime-node-refresh\n\n**RnR** - is tiny lib to refresh node setup on runtime without restarting the node server.\n\n# Install\n\n```sh\nnpm install --save runtime-node-refresh\n```\n\n# Usage\n \nFollowing you will find example of simple project created via `npm` which uses `runtime-node-refresh` to refresh environment variable without running the node script again. Notice that the message to update environment variable came from other node process.\n\nCreate `index.js` file and add the following code:\n\n```javascript\nimport RnR from 'runtime-node-refresh';\n\nprocess.env.LOG_LEVEL = 'error';\n\nRnR(() =\u003e {\n  process.env.LOG_LEVEL = 'debug';\n});\n\nsetInterval(() =\u003e console.log(`The LOG_LEVEL is set to ${process.env.LOG_LEVEL}`), 3000);\n```\n\nCreate `package.json' file and fill it with the following:\n```json\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.6\"\n    }\n  }\n```\n\nOpen two terminals, in the first terminal execute:\n\n```sh\nnpm start\n```\n\n\nRun the refresh task in the second terminal:\n\n```sh\nnpm run refresh\n```\n\nBack to first termiinal and see if the LOG_LEVEL variable value changed to debug.\n## Real life example:\n\nIt may be very usefult when you want to restart/update environment variable on running node application without restarting the node server.\nThe real life example of `RnR` lib usage can be find in the following express based web-application:\nhttps://github.com/przemek-nowicki/node-express-template.ts/blob/master/src/core/utils/logger.ts#L2\n\n**Note:** RnR is using node signals which means it does not work on Worker threads.\nIt uses SIGPIPE signal to communicate between nodejs processes.\nBy default the SIGPIPE is ignored by NodeJS. \nHowever it is recommend to check if you don't have a listener installed on SIGPIPE in your project before you use `RnR` library.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprzemek-nowicki%2Fruntime-node-refresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprzemek-nowicki%2Fruntime-node-refresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprzemek-nowicki%2Fruntime-node-refresh/lists"}