{"id":16832647,"url":"https://github.com/zswang/rtconfig","last_synced_at":"2025-10-20T09:19:33.970Z","repository":{"id":57355770,"uuid":"63919657","full_name":"zswang/rtconfig","owner":"zswang","description":"A real time updated configuration.","archived":false,"fork":false,"pushed_at":"2018-02-09T14:39:45.000Z","size":20,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T02:40:17.432Z","etag":null,"topics":["configuration"],"latest_commit_sha":null,"homepage":null,"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/zswang.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":"2016-07-22T03:12:38.000Z","updated_at":"2018-02-09T09:14:27.000Z","dependencies_parsed_at":"2022-09-05T21:30:23.330Z","dependency_job_id":null,"html_url":"https://github.com/zswang/rtconfig","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/zswang%2Frtconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Frtconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Frtconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Frtconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zswang","download_url":"https://codeload.github.com/zswang/rtconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345202,"owners_count":21088231,"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":["configuration"],"created_at":"2024-10-13T11:49:53.742Z","updated_at":"2025-10-20T09:19:28.950Z","avatar_url":"https://github.com/zswang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Real Time Config 实时配置\n-------\n\n# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url]\n\n## 背景\n\n服务变更配置时通常需要重启进程，但这样会导致服务中断，一些事务性的处理会受到影响，严重时会导致数据异常。为此写了一个通过侦测文件修改时间刷新配置的小工具。\n\n### 需求场景\n\n* 标识服务器升级中，停止写入操作；\n* 按运营需要调整数值；\n* 动态切换连接服务器。\n\n## 使用\n\n### 安装\n\n```bash\n$ npm install rtconfig --save\n```\n\n### 示例\n\n```js\nvar RealtimeConfig = require('rtconfig');\n\nvar config = new RealtimeConfig('config/config.js');\n\napp.get('commit', function (req, res) {\n\tif (config.updating) {\n\t\tres.json({\n\t\t\terror: '正在升级，请稍后重试。'\n\t\t});\n\t\treturn;\n\t}\n\t// ...\n});\n```\n\n## 小成本修改\n\n### 修改前\n\n```js\nconst config = require('./config.json');\n```\n\n### 修改后\n\n```js\nconst config = new (require('rtconfig'))('./config.json');\n```\n\n\u003e 已投入实战，请放心使用\n\n## License\n\nMIT © [zswang](http://weibo.com/zswang)\n\n[npm-url]: https://npmjs.org/package/rtconfig\n[npm-image]: https://badge.fury.io/js/rtconfig.svg\n[travis-url]: https://travis-ci.org/zswang/rtconfig\n[travis-image]: https://travis-ci.org/zswang/rtconfig.svg?branch=master\n[coverage-url]: https://coveralls.io/github/zswang/rtconfig?branch=master\n[coverage-image]: https://coveralls.io/repos/zswang/rtconfig/badge.svg?branch=master\u0026service=github\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzswang%2Frtconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzswang%2Frtconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzswang%2Frtconfig/lists"}