docs: add Netts onboarding steps

This commit is contained in:
你的用户名
2025-11-03 21:02:28 +08:00
parent 891c32e288
commit 4543c6bf98
2 changed files with 39 additions and 0 deletions

View File

@@ -90,3 +90,15 @@ CI 流程(`.github/workflows/ci.yaml`)会执行 `go fmt`, `go vet`, `go test
- 监控:可通过 `/healthz` 结合现有 Prometheus/Consul 健康检查;同时建议订阅 Netts 提供的 webhook 以获知能量下发事件。
更多架构细节、部署流程以及 CI/CD 建议请参阅 `docs/architecture.md` 与 `docs/deployment.md`。
## Netts 平台接入流程
在部署本服务之前,请确保完成 Netts Workspace 的账号准备(详见 `docs/deployment.md` 中的“Netts 账号准备流程”):
1. 注册并登录 [https://netts.io/workspace](https://netts.io/workspace),生成 API Key
2. 在 Wallet 页面充值 TRX保证账户余额可覆盖租赁费用
3. 在 API 设置中配置服务器出口 IP 白名单;
4. 将 API Key、Real IP、回调地址写入 `config.yaml` 或环境变量;
5. 通过 `curl https://netts.io/apiv2/userinfo`(携带 `X-API-KEY` 与 `X-Real-IP`)验证连通性。
完成上述步骤后,才可由本服务调用 Netts 接口完成能量租赁。

View File

@@ -8,6 +8,33 @@
- 配置 IP 白名单(若使用代理,可在 `config.yaml` 中设置 `netts.realIp`
- 充值余额,以便购买能量周期。
## Netts 账号准备流程
1. **注册 Workspace 账号**
- 打开 [https://netts.io/workspace](https://netts.io/workspace) 使用邮箱注册并登录;
- 首次登录后系统会自动给当前账号生成一组 API Key。
2. **完成余额充值**
- 在 Workspace → Wallet 菜单中充值 TRX建议先充 1020 TRX 做验证);
- Netts 扣费直接来自账户余额,没有余额将无法下单购买能量。
3. **配置 IP 白名单**
- 进入 Workspace → API → IP Whitelist将本服务所在服务器的出口 IP 填入;
- 如果经由代理访问,可在配置文件 `netts.realIp` 中设置对应的公网 IP。
4. **获取并保管 API Key**
- 在 Workspace → API 区域复制 Key
- 设置到 `config.yaml``netts.apiKey` 字段,或通过 `NETTS_API_KEY` 环境变量注入;
- 生产环境请妥善存储在 Secrets 或 Vault 中。
5. **可选:配置回调地址**
- 若希望接收能量下发事件,可在 Workspace → Host Mode Callback处填写统一回调 URL
- 亦可在调用本服务的 `/api/v1/energy/rent` 时传入 `callback_url` 覆盖。
6. **API 验证**
- 使用 cURL/ Postman 请求 `https://netts.io/apiv2/userinfo`,在 Header 中携带 `X-API-KEY``X-Real-IP`
- 当返回 `status=success`说明账号、Key 与白名单均已生效。
## 构建
```bash