{"id":46638304,"url":"https://github.com/tetherto/tether-wrk-base","last_synced_at":"2026-03-08T02:13:25.721Z","repository":{"id":332762063,"uuid":"812705018","full_name":"tetherto/tether-wrk-base","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-15T11:46:56.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-01-15T16:29:26.173Z","etag":null,"topics":[],"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/tetherto.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-09T16:41:14.000Z","updated_at":"2026-01-15T11:47:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/tether-wrk-base","commit_stats":null,"previous_names":["tetherto/tether-wrk-base"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/tether-wrk-base","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Ftether-wrk-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Ftether-wrk-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Ftether-wrk-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Ftether-wrk-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/tether-wrk-base/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Ftether-wrk-base/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-03-08T02:13:25.165Z","updated_at":"2026-03-08T02:13:25.698Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tether-wrk-base\nA base worker class extending `bfx-wrk-base`.\n\n## Introduction\n\nThe `tether-wrk-base` class is designed to initialize and configure services for the base worker. It simplifies the setup of facilities such as service storage and networking, starts an RPC server, and provides methods for handling RPC requests.\n\n### Architecture\n\nTo run this worker, the `init()` function must be called in the constructor during the worker's initialization.\n\nThe worker is run using `bfx-svc-boot-js`. The initial code is written in `worker.js`, which is used to load the code in `workers/base.wrk.tether.js` via a Bash command:\n\n```bash\nnode worker.js --wtype tether-wrk-base --env development --debug true\n```\n\nFor more details, refer to the repository [`bfx-svc-boot-js`](https://github.com/bitfinexcom/bfx-svc-boot-js).\n\n\n## Documentation\n\n### Methods\n\n#### `init()`\n\nThis method initializes the class by:\n\n- Loading the configuration from the `config/common.json` file.\n- Setting up facilities for service storage and networking.\n- Configuring the logger with the appropriate log level (`debug` or `info`).\n\n#### `getRpcKey()`\n\nThis method returns the RPC public key of the worker.\n\n#### `getRpcClientKey()`\n\nThis method returns the RPC client key of the worker.\n\n#### `_startRpcServer()`\n\nThis method starts the RPC server using the `hp-svc-facs-net` facility. It can be overridden if extra logic is needed while starting the RPC server.\n\n#### `_start(cb)`\n\nThis method manages the complete startup process of the worker:\n\n- It calls the parent class's `_start()` method to initialize the base components.\n- It starts the RPC server and defines an RPC function `ping` to test if the worker is operational.\n- It saves the RPC server's public key in the worker's status.\n\n\n### Configuration\n\n- Configuration is loaded from the `config/common.json` file.\n  Example of `common.json`:\n\n  ```json\n  {\n    \"debug\": 0\n  }\n  ```\n\n  The `debug` key controls the logging level in the worker.\n\n- The class sets up the following facilities:\n\n  - **`hp-svc-facs-store`**: A facility that exposes persistent Holepunch datastores.\n    This facility does not require any additional configuration files.\n\n  - **`hp-svc-facs-net`**: A facility that provides access to the Holepunch networking stack (Hyperswarm).\n    Its configuration is loaded from `config/facs/net.config.json`.\n    Example of `net.config.json`:\n\n    ```json\n    {\n      \"r0\": {\n        \"allow\": [],\n        \"allowLocal\": true\n      }\n    }\n    ```\n\n    - **`allow`**: An array used as an allowlist to validate incoming connections based on their `remotePublicKey`.  \n    - **`allowLocal`**: If set to `true`, the function allows connections originating from the local IP address.\n\n- The `setup-config.sh` script is used to convert all `config.json.example` files into `config.json`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Ftether-wrk-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Ftether-wrk-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Ftether-wrk-base/lists"}