openclaw config
读取、写入和管理 OpenClaw 的配置项。支持点分路径符号访问嵌套配置。
命令签名
bash
openclaw config <子命令> [选项]子命令
| 子命令 | 说明 |
|---|---|
get | 读取指定配置项的值 |
set | 设置指定配置项的值 |
list | 列出所有配置项 |
edit | 在编辑器中打开配置文件 |
reset | 重置配置项为默认值 |
openclaw config get
读取指定路径的配置值。
bash
openclaw config get <path>路径使用点分符号表示嵌套层级:
bash
openclaw config get agents.default.model
# 输出: gpt-4openclaw config set
设置指定路径的配置值。
bash
openclaw config set <path> <value> [选项]| 选项 | 类型 | 说明 |
|---|---|---|
--json | boolean | 将 value 作为 JSON 解析 |
bash
# 设置字符串值
openclaw config set agents.default.model gpt-4
# 设置 JSON 值(数组或对象)
openclaw config set agents.default.channels '["whatsapp","telegram"]' --jsonopenclaw config list
列出所有配置项及其当前值。
bash
openclaw config list [选项]| 选项 | 类型 | 说明 |
|---|---|---|
--flat | boolean | 平铺显示所有键值对 |
--json | boolean | JSON 格式输出 |
openclaw config edit
在默认编辑器中打开配置文件。
bash
openclaw config edit使用 $EDITOR 环境变量指定的编辑器,未设置时使用系统默认编辑器。
路径符号
配置路径使用点分隔符访问嵌套字段:
agents.default.model → agents > default > model
channels.whatsapp.enabled → channels > whatsapp > enabled
gateway.port → gateway > port示例
bash
# 获取配置值
openclaw config get gateway.port
# 设置端口
openclaw config set gateway.port 18789
# 列出所有配置
openclaw config list
# 平铺显示
openclaw config list --flat
# 编辑配置文件
openclaw config edit
# 重置为默认值
openclaw config reset gateway.port另请参阅
openclaw configure— 交互式配置向导openclaw doctor— 诊断配置问题- 配置参考 — 完整配置项说明
