Skip to content

Commit 493828b

Browse files
committed
docs: env variable
1 parent 1fd4cb8 commit 493828b

File tree

4 files changed

+122
-5
lines changed

4 files changed

+122
-5
lines changed

.vitepress/en.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function sidebarAPI(): DefaultTheme.SidebarItem[] {
237237
{ text: 'swanlab login', link: 'cli-swanlab-login' },
238238
{ text: 'swanlab logout', link: 'cli-swanlab-logout' },
239239
{ text: 'swanlab convert', link: 'cli-swanlab-convert' },
240-
{ text: '(Beta) swanlab remote gpu', link: 'cli-swanlab-remote-gpu' },
240+
// { text: '(Beta) swanlab remote gpu', link: 'cli-swanlab-remote-gpu' },
241241
{ text: 'Other', link: 'cli-swanlab-other' },
242242
]
243243
},
@@ -256,5 +256,13 @@ function sidebarAPI(): DefaultTheme.SidebarItem[] {
256256
{ text: 'integration', link: 'py-integration' },
257257
{ text: 'converter', link: 'py-converter' },
258258
]
259-
},]
260-
}
259+
},
260+
{
261+
text: 'Other',
262+
// collapsed: false,
263+
items: [
264+
{ text: 'Environment Variables', link: 'environment-variable' },
265+
]
266+
}
267+
]
268+
}

.vitepress/zh.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function sidebarAPI(): DefaultTheme.SidebarItem[] {
237237
{ text: 'swanlab login', link: 'cli-swanlab-login' },
238238
{ text: 'swanlab logout', link: 'cli-swanlab-logout' },
239239
{ text: 'swanlab convert', link: 'cli-swanlab-convert' },
240-
{ text: '(内测中) swanlab remote gpu', link: 'cli-swanlab-remote-gpu' },
240+
// { text: '(内测中) swanlab remote gpu', link: 'cli-swanlab-remote-gpu' },
241241
{ text: '其他', link: 'cli-swanlab-other' },
242242
]
243243
},
@@ -256,5 +256,16 @@ function sidebarAPI(): DefaultTheme.SidebarItem[] {
256256
{ text: 'integration', link: 'py-integration' },
257257
{ text: 'converter', link: 'py-converter' },
258258
]
259-
},]
259+
},
260+
{
261+
text: '其他',
262+
// collapsed: false,
263+
items: [
264+
{ text: '环境变量', link: 'environment-variable' },
265+
]
266+
}
267+
268+
269+
270+
]
260271
}

en/api/environment-variable.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Environment Variables
2+
3+
[⚙️Full Environment Variables -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)
4+
5+
## Global Configuration
6+
7+
### `SWANLAB_FOLDER`
8+
- **Description**: The path where the SwanLab global folder is saved, defaulting to the `.swanlab` folder in the user's home directory.
9+
- **Environment Variable**: `SWANLAB_FOLDER`
10+
11+
### `SWANLOG_FOLDER`
12+
- **Description**: The path where SwanLab parsed log files are saved, defaulting to the `swanlog` folder in the current running directory.
13+
- **Environment Variable**: `SWANLOG_FOLDER`
14+
15+
### `SWANLAB_MODE`
16+
- **Description**: The parsing mode of SwanLab, involving callbacks registered by the operator. Currently, there are three modes: `local`, `cloud`, and `disabled`, with the default being `cloud`. **Note: Case sensitive**.
17+
- **Environment Variable**: `SWANLAB_MODE`
18+
19+
## Service Configuration
20+
21+
### `SWANBOARD_PROT`
22+
- **Description**: The port for the CLI offline dashboard `swanboard` service.
23+
- **Environment Variable**: `SWANLAB_BOARD_PORT`
24+
25+
### `SWANBOARD_HOST`
26+
- **Description**: The address for the CLI offline dashboard `swanboard` service.
27+
- **Environment Variable**: `SWANLAB_BOARD_HOST`
28+
29+
### `SWANLAB_WEB_HOST`
30+
- **Description**: The web address for the SwanLab cloud environment.
31+
- **Environment Variable**: `SWANLAB_WEB_HOST`
32+
33+
### `API_HOST`
34+
- **Description**: The API address for the SwanLab cloud environment.
35+
- **Environment Variable**: `SWANLAB_API_HOST`
36+
37+
## Login Authentication
38+
39+
### `SWANLAB_API_KEY`
40+
- **Description**: The cloud API Key. During login, this environment variable is checked first. If it does not exist, it checks whether the user is already logged in. If not logged in, the login process is initiated.
41+
- If a string is passed to the `login` interface, this environment variable is invalid.
42+
- If the user is already logged in, this environment variable takes precedence over locally stored login information.
43+
- **Environment Variable**: `SWANLAB_API_KEY`
44+
45+
## Others
46+
47+
### `SWANLAB_WEBHOOK`
48+
- **Description**: Webhook address. If this environment variable exists, SwanLab will call this address to send a message upon successful initialization.
49+
- **Environment Variable**: `SWANLAB_WEBHOOK`

zh/api/environment-variable.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 环境变量
2+
3+
[⚙️完整环境变量 -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)
4+
5+
## 全局配置
6+
7+
### `SWANLAB_FOLDER`
8+
- **描述**: SwanLab 全局文件夹保存的路径,默认为用户主目录下的 `.swanlab` 文件夹。
9+
- **环境变量**: `SWANLAB_FOLDER`
10+
11+
### `SWANLOG_FOLDER`
12+
- **描述**: SwanLab 解析日志文件保存的路径,默认为当前运行目录的 `swanlog` 文件夹。
13+
- **环境变量**: `SWANLOG_FOLDER`
14+
15+
### `SWANLAB_MODE`
16+
- **描述**: SwanLab 的解析模式,涉及操作员注册的回调。目前有三种模式:`local``cloud``disabled`,默认为 `cloud`**注意:大小写敏感**
17+
- **环境变量**: `SWANLAB_MODE`
18+
19+
## 服务配置
20+
21+
### `SWANBOARD_PROT`
22+
- **描述**: CLI 离线看板 `swanboard` 服务的端口。
23+
- **环境变量**: `SWANLAB_BOARD_PORT`
24+
25+
### `SWANBOARD_HOST`
26+
- **描述**: CLI 离线看板 `swanboard` 服务的地址。
27+
- **环境变量**: `SWANLAB_BOARD_HOST`
28+
29+
### `SWANLAB_WEB_HOST`
30+
- **描述**: SwanLab 云端环境的 Web 地址。
31+
- **环境变量**: `SWANLAB_WEB_HOST`
32+
33+
### `API_HOST`
34+
- **描述**: SwanLab 云端环境的 API 地址。
35+
- **环境变量**: `SWANLAB_API_HOST`
36+
37+
## 登录认证
38+
39+
### `SWANLAB_API_KEY`
40+
- **描述**: 云端 API Key。登录时会首先查找此环境变量,如果不存在,判断用户是否已登录,未登录则进入登录流程。
41+
- 如果 `login` 接口传入字符串,此环境变量无效。
42+
- 如果用户已登录,此环境变量的优先级高于本地存储的登录信息。
43+
- **环境变量**: `SWANLAB_API_KEY`
44+
45+
## 其他
46+
47+
### `SWANLAB_WEBHOOK`
48+
- **描述**: Webhook 地址。SwanLab 初始化完毕时,如果此环境变量存在,会调用此地址发送消息。
49+
- **环境变量**: `SWANLAB_WEBHOOK`

0 commit comments

Comments
 (0)