Skip to content

Commit

Permalink
docs: env
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Jan 17, 2025
1 parent 5d84107 commit 9f4c2ee
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 70 deletions.
53 changes: 18 additions & 35 deletions en/api/environment-variable.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
# Environment Variables

[️Full Environment Variables -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)
[️Complete Environment Variables 1 -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)[⚙️Complete Environment Variables 2 -> Github](https://github.com/SwanHubX/SwanLab-Toolkit/blob/main/swankit/env.py)

## Global Configuration

### `SWANLAB_FOLDER`
- **Description**: The path where the SwanLab global folder is saved, defaulting to the `.swanlab` folder in the user's home directory.
- **Environment Variable**: `SWANLAB_FOLDER`

### `SWANLOG_FOLDER`
- **Description**: The path where SwanLab parsed log files are saved, defaulting to the `swanlog` folder in the current running directory.
- **Environment Variable**: `SWANLOG_FOLDER`

### `SWANLAB_MODE`
- **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**.
- **Environment Variable**: `SWANLAB_MODE`
| Environment Variable | Description | Default Value |
| --- | --- | --- |
| `SWANLAB_SAVE_DIR` | Path where SwanLab global folder is saved | `.swanlab` folder in the user's home directory |
| `SWANLAB_LOG_DIR` | Path where SwanLab parsed log files are saved | `swanlog` folder in the current working directory |
| `SWANLAB_MODE` | SwanLab's parsing mode, which involves callbacks registered by the operator. Currently, there are three modes: `local`, `cloud`, and `disabled`. **Note: Case-sensitive** | `cloud` |

## Service Configuration

### `SWANBOARD_PROT`
- **Description**: The port for the CLI offline dashboard `swanboard` service.
- **Environment Variable**: `SWANLAB_BOARD_PORT`

### `SWANBOARD_HOST`
- **Description**: The address for the CLI offline dashboard `swanboard` service.
- **Environment Variable**: `SWANLAB_BOARD_HOST`

### `SWANLAB_WEB_HOST`
- **Description**: The web address for the SwanLab cloud environment.
- **Environment Variable**: `SWANLAB_WEB_HOST`

### `API_HOST`
- **Description**: The API address for the SwanLab cloud environment.
- **Environment Variable**: `SWANLAB_API_HOST`
| Environment Variable | Description |
| --- | --- |
| `SWANLAB_BOARD_PORT` | Port for the CLI offline dashboard `swanboard` service |
| `SWANLAB_BOARD_HOST` | Address for the CLI offline dashboard `swanboard` service |
| `SWANLAB_WEB_HOST` | Web address for the SwanLab cloud environment |
| `SWANLAB_API_HOST` | API address for the SwanLab cloud environment |

## Login Authentication

### `SWANLAB_API_KEY`
- **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.
- If a string is passed to the `login` interface, this environment variable is invalid.
- If the user is already logged in, this environment variable takes precedence over locally stored login information.
- **Environment Variable**: `SWANLAB_API_KEY`
| Environment Variable | Description |
| --- | --- |
| `SWANLAB_API_KEY` | Cloud API Key. During login, this environment variable is checked first. If it doesn't exist, the system checks if the user is already logged in. If not, the login process is initiated.<br>- If a string is passed to the `login` interface, this environment variable is ignored.<br>- If the user is already logged in, this environment variable takes precedence over locally stored login information. |

## Others

### `SWANLAB_WEBHOOK`
- **Description**: Webhook address. If this environment variable exists, SwanLab will call this address to send a message upon successful initialization.
- **Environment Variable**: `SWANLAB_WEBHOOK`
| Environment Variable | Description |
| --- | --- |
| `SWANLAB_WEBHOOK` | Webhook address.<br> When SwanLab initialization is complete, if this environment variable exists, it will be called to send a message. |
53 changes: 18 additions & 35 deletions zh/api/environment-variable.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
# 环境变量

[️完整环境变量 -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)
[️完整环境变量1 -> Github](https://github.com/SwanHubX/SwanLab/blob/main/swanlab/env.py)[⚙️完整环境变量2 -> Github](https://github.com/SwanHubX/SwanLab-Toolkit/blob/main/swankit/env.py)

## 全局配置

### `SWANLAB_FOLDER`
- **描述**: SwanLab 全局文件夹保存的路径,默认为用户主目录下的 `.swanlab` 文件夹。
- **环境变量**: `SWANLAB_FOLDER`

### `SWANLOG_FOLDER`
- **描述**: SwanLab 解析日志文件保存的路径,默认为当前运行目录的 `swanlog` 文件夹。
- **环境变量**: `SWANLOG_FOLDER`

### `SWANLAB_MODE`
- **描述**: SwanLab 的解析模式,涉及操作员注册的回调。目前有三种模式:`local``cloud``disabled`,默认为 `cloud`**注意:大小写敏感**
- **环境变量**: `SWANLAB_MODE`
| 环境变量 | 描述 | 默认值 |
| --- | --- | --- |
| `SWANLAB_SAVE_DIR` | SwanLab 全局文件夹保存的路径 | 用户主目录下的 `.swanlab` 文件夹 |
| `SWANLAB_LOG_DIR` | SwanLab 解析日志文件保存的路径 | 当前运行目录的 `swanlog` 文件夹 |
| `SWANLAB_MODE` | SwanLab 的解析模式,涉及操作员注册的回调。目前有三种模式:`local``cloud``disabled`**注意:大小写敏感** | `cloud` |

## 服务配置

### `SWANBOARD_PROT`
- **描述**: CLI 离线看板 `swanboard` 服务的端口。
- **环境变量**: `SWANLAB_BOARD_PORT`

### `SWANBOARD_HOST`
- **描述**: CLI 离线看板 `swanboard` 服务的地址。
- **环境变量**: `SWANLAB_BOARD_HOST`

### `SWANLAB_WEB_HOST`
- **描述**: SwanLab 云端环境的 Web 地址。
- **环境变量**: `SWANLAB_WEB_HOST`

### `API_HOST`
- **描述**: SwanLab 云端环境的 API 地址。
- **环境变量**: `SWANLAB_API_HOST`
| 环境变量 | 描述 |
| --- | --- |
| `SWANLAB_BOARD_PORT` | CLI 离线看板 `swanboard` 服务的端口 |
| `SWANLAB_BOARD_HOST` | CLI 离线看板 `swanboard` 服务的地址 |
| `SWANLAB_WEB_HOST` | SwanLab 云端环境的 Web 地址 |
| `SWANLAB_API_HOST` | SwanLab 云端环境的 API 地址 |

## 登录认证

### `SWANLAB_API_KEY`
- **描述**: 云端 API Key。登录时会首先查找此环境变量,如果不存在,判断用户是否已登录,未登录则进入登录流程。
- 如果 `login` 接口传入字符串,此环境变量无效。
- 如果用户已登录,此环境变量的优先级高于本地存储的登录信息。
- **环境变量**: `SWANLAB_API_KEY`
| 环境变量 | 描述 |
| --- | --- |
| `SWANLAB_API_KEY` | 云端 API Key。登录时会首先查找此环境变量,如果不存在,判断用户是否已登录,未登录则进入登录流程。<br>- 如果 `login` 接口传入字符串,此环境变量无效<br>- 如果用户已登录,此环境变量的优先级高于本地存储的登录信息 |

## 其他

### `SWANLAB_WEBHOOK`
- **描述**: Webhook 地址。SwanLab 初始化完毕时,如果此环境变量存在,会调用此地址发送消息。
- **环境变量**: `SWANLAB_WEBHOOK`
| 环境变量 | 描述 |
| --- | --- |
| `SWANLAB_WEBHOOK` | Webhook 地址。<br> SwanLab 初始化完毕时,如果此环境变量存在,会调用此地址发送消息 |

0 comments on commit 9f4c2ee

Please sign in to comment.