Skip to content

Commit

Permalink
update readme: config api doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdashuaihenshuai committed Dec 12, 2023
1 parent 065bc8e commit 47701ad
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,41 @@ $ yarn global add @huolala-tech/page-spy-api
$ npm install -g @huolala-tech/page-spy-api
```

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

### 如何修改 API 服务配置

#### 修改端口

命令行中直接执行 `page-spy-api` 命令会在运行目录下面生成配置文件 config.json,修改配置文件可以修改运行端口:

```json
{
"port": "6752"
}
```

部署完成后浏览器访问 `<host>:6752`,页面顶部会出现 `接入 SDK` 菜单,点击菜单查看如何在业务项目中配置并集成。
#### 多实例部署(需要升级到 1.5.0 版本以上才可以使用)

`rpcAddress` 配置是多实例部署配置,其中 ip 和 port 是多个机器 ip 以及 rpc 端口,多个实例通过 rpc 来通信,程序会根据机器 ip 来启动 rpc 服务,所以得保证 ip 不会重复,不然可能会出现消息错乱丢失问题。

```json
{
"port": "6752",
"rpcAddress": [
{
"ip": "192.168.123.1",
"port": "20008"
},
{
"ip": "192.168.123.2",
"port": "20008"
}
]
}
```

### 如何修改 API 服务配置

## 技术支持

Expand Down
29 changes: 26 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,39 @@ $ yarn global add @huolala-tech/page-spy-api
$ npm install -g @huolala-tech/page-spy-api
```

After the download is complete, you can directly execute `page-spy-api` in the command line to start the service.
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.
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.

### How to Modify API Service Configuration

#### Modifying the Port

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:

```json
{
"port": "6752"
}
```

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.
#### Multi-instance Deployment (Requires upgrading to version 1.5.0 or above)

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.

```json
{
"port": "6752",
"rpcAddress": [
{
"ip": "192.168.123.1",
"port": "20008"
},
{
"ip": "192.168.123.2",
"port": "20008"
}
]
}
```

## Roadmap

Expand Down

0 comments on commit 47701ad

Please sign in to comment.