Skip to content

Commit 47701ad

Browse files
update readme: config api doc.
1 parent 065bc8e commit 47701ad

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,41 @@ $ yarn global add @huolala-tech/page-spy-api
5454
$ npm install -g @huolala-tech/page-spy-api
5555
```
5656

57-
安装完成之后你可以在命令行中直接执行 `page-spy-api` 启动服务。该命令会在运行目录下面生成配置文件 config.json,修改配置文件可以修改运行端口:
57+
安装完成之后你可以在命令行中直接执行 `page-spy-api` 启动服务。部署完成后浏览器访问 `<host>:6752`,页面顶部会出现 `接入 SDK` 菜单,点击菜单查看如何在业务项目中配置并集成。
58+
59+
### 如何修改 API 服务配置
60+
61+
#### 修改端口
62+
63+
命令行中直接执行 `page-spy-api` 命令会在运行目录下面生成配置文件 config.json,修改配置文件可以修改运行端口:
5864

5965
```json
6066
{
6167
"port": "6752"
6268
}
6369
```
6470

65-
部署完成后浏览器访问 `<host>:6752`,页面顶部会出现 `接入 SDK` 菜单,点击菜单查看如何在业务项目中配置并集成。
71+
#### 多实例部署(需要升级到 1.5.0 版本以上才可以使用)
72+
73+
`rpcAddress` 配置是多实例部署配置,其中 ip 和 port 是多个机器 ip 以及 rpc 端口,多个实例通过 rpc 来通信,程序会根据机器 ip 来启动 rpc 服务,所以得保证 ip 不会重复,不然可能会出现消息错乱丢失问题。
74+
75+
```json
76+
{
77+
"port": "6752",
78+
"rpcAddress": [
79+
{
80+
"ip": "192.168.123.1",
81+
"port": "20008"
82+
},
83+
{
84+
"ip": "192.168.123.2",
85+
"port": "20008"
86+
}
87+
]
88+
}
89+
```
90+
91+
### 如何修改 API 服务配置
6692

6793
## 技术支持
6894

README_EN.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,39 @@ $ yarn global add @huolala-tech/page-spy-api
5252
$ npm install -g @huolala-tech/page-spy-api
5353
```
5454

55-
After the download is complete, you can directly execute `page-spy-api` in the command line to start the service.
56-
It will also generate a configuration file called config.json in the running directory, and modifying this file allows you to change the running port.
55+
After the download is complete, you can directly execute `page-spy-api` in the command line to start the service. Once the deployment is successful, you can open the browser and access `<host>:6752`, the `Inject SDK` menu will be at the top, and you can find how to configure and integrate in the business project by click the menu.
56+
57+
### How to Modify API Service Configuration
58+
59+
#### Modifying the Port
60+
61+
Executing the page-spy-api command directly in the command line will generate a configuration file named config.json in the working directory. You can modify the running port by modifying this configuration file:
5762

5863
```json
5964
{
6065
"port": "6752"
6166
}
6267
```
6368

64-
Once the deployment is successful, you can open the browser and access `<host>:6752`, the `Inject SDK` menu will be at the top, and you can find how to configure and integrate in the business project by click the menu.
69+
#### Multi-instance Deployment (Requires upgrading to version 1.5.0 or above)
70+
71+
The rpcAddress configuration is used for multi-instance deployment, where IP and port represent the IP addresses and RPC ports of multiple machines. Multiple instances communicate with each other through RPC, and the program starts the RPC service based on the machine's IP. Therefore, it is important to ensure that IP addresses are unique to avoid potential issues of message confusion or loss.
72+
73+
```json
74+
{
75+
"port": "6752",
76+
"rpcAddress": [
77+
{
78+
"ip": "192.168.123.1",
79+
"port": "20008"
80+
},
81+
{
82+
"ip": "192.168.123.2",
83+
"port": "20008"
84+
}
85+
]
86+
}
87+
```
6588

6689
## Roadmap
6790

0 commit comments

Comments
 (0)