config 命令
config 命令用于查看和修改配置。
用法
bash
openclaw config [子命令] [选项]子命令
| 子命令 | 描述 |
|---|---|
get | 获取配置值 |
set | 设置配置值 |
list | 列出所有配置 |
edit | 编辑配置文件 |
reset | 重置为默认配置 |
export | 导出配置 |
import | 导入配置 |
diff | 比较配置差异 |
选项
| 选项 | 描述 |
|---|---|
--key <path> | 配置路径 (如 gateway.port) |
--global | 全局配置 |
--local | 本地配置 |
--json | JSON 格式输出 |
示例
bash
# 列出所有配置
openclaw config list
# 获取配置值
openclaw config get gateway.port
openclaw config get models.openai.api_key
# 设置配置值
openclaw config set gateway.port 8211
openclaw config set theme dark
# 编辑配置文件
openclaw config edit
# 重置为默认
openclaw config reset
# 导出配置
openclaw config export > config.yaml
# 导入配置
openclaw config import config.yaml
# 比较差异
openclaw config diff --other config_backup.yaml配置文件位置
| 环境 | 位置 |
|---|---|
| Linux | ~/.config/openclaw/config.yaml |
| macOS | ~/Library/Application Support/openclaw/config.yaml |
| Windows | %APPDATA%\openclaw\config.yaml |
交互式编辑
bash
# 使用默认编辑器
openclaw config edit
# 使用指定编辑器
openclaw config edit --editor vim