Просмотр исходного кода

docs: add note about requiring conf and resources directories (or specifying paths via -c and RUSTDESK_API_GIN_RESOURCES_PATH) when running without docker (#311)

Plynksiy Nikita месяцев назад: 6
Родитель
Сommit
16b941e37f
2 измененных файлов с 17 добавлено и 4 удалено
  1. 6 0
      README.md
  2. 11 4
      README_EN.md

+ 6 - 0
README.md

@@ -255,6 +255,12 @@
255
     #或者使用generate_api.go生成api并运行
255
     #或者使用generate_api.go生成api并运行
256
     go generate generate_api.go
256
     go generate generate_api.go
257
     ```
257
     ```
258
+   > 注意:使用 `go run` 或编译后的二进制时,当前目录下必须存在 `conf` 和 `resources`
259
+   > 目录。如果在其他目录运行,可通过 `-c` 和环境变量
260
+   > `RUSTDESK_API_GIN_RESOURCES_PATH` 指定绝对路径,例如:
261
+   > ```bash
262
+   > RUSTDESK_API_GIN_RESOURCES_PATH=/opt/rustdesk-api/resources ./apimain -c /opt/rustdesk-api/conf/config.yaml
263
+   > ```
258
 5. 编译,如果想自己编译,先cd到项目根目录,然后windows下直接运行`build.bat`,linux下运行`build.sh`,编译后会在`release`
264
 5. 编译,如果想自己编译,先cd到项目根目录,然后windows下直接运行`build.bat`,linux下运行`build.sh`,编译后会在`release`
259
    目录下生成对应的可执行文件。直接运行编译后的可执行文件即可。
265
    目录下生成对应的可执行文件。直接运行编译后的可执行文件即可。
260
 
266
 

+ 11 - 4
README_EN.md

@@ -252,10 +252,17 @@ Download the release from [release](https://github.com/lejianwen/rustdesk-api/re
252
 4. Run:
252
 4. Run:
253
     ```bash
253
     ```bash
254
     # Run directly
254
     # Run directly
255
-    go run cmd/apimain.go
256
-    # Or generate and run the API using generate_api.go
257
-    go generate generate_api.go
258
-    ```
255
+   go run cmd/apimain.go
256
+   # Or generate and run the API using generate_api.go
257
+   go generate generate_api.go
258
+   ```
259
+   > **Note:** When using `go run` or the compiled binary, the `conf` and `resources`
260
+   > directories must exist relative to the current working directory. If you run
261
+   > the program from another location, specify absolute paths with `-c` and the
262
+   > `RUSTDESK_API_GIN_RESOURCES_PATH` environment variable. Example:
263
+   > ```bash
264
+   > RUSTDESK_API_GIN_RESOURCES_PATH=/opt/rustdesk-api/resources ./apimain -c /opt/rustdesk-api/conf/config.yaml
265
+   > ```
259
 
266
 
260
 5. To compile, change to the project root directory. For Windows, run `build.bat`, and for Linux, run `build.sh`. After
267
 5. To compile, change to the project root directory. For Windows, run `build.bat`, and for Linux, run `build.sh`. After
261
    compiling, the corresponding executables will be generated in the `release` directory. Run the compiled executables
268
    compiling, the corresponding executables will be generated in the `release` directory. Run the compiled executables