Fix openclaw config syntax - use external json file

- Move openclaw config to separate json file
- Reference file directly in podman module
- Remove problematic builtins.toJSON with nested arrays

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ashisgreat22 2026-03-18 01:37:46 +01:00
parent a595445bd2
commit ae5e61cb6e
3 changed files with 46 additions and 49 deletions

View file

@ -104,52 +104,4 @@
ZAI_API_KEY=${config.sops.placeholder.openclaw_zai_api_key}
'';
};
sops.templates."openclaw_config.json" = {
content = builtins.toJSON {
gateway = {
port = 18789;
bind = "0.0.0.0";
trustedProxies = ["::1", "127.0.0.1", "10.88.0.0/16", "10.89.0.0/16"];
auth = {
mode = "none";
};
controlUi = {
dangerouslyAllowHostHeaderOriginFallback = true;
allowedOrigins = ["*"];
};
};
channels = {
discord = {
enabled = true;
groupPolicy = "open";
dmPolicy = "open";
allowFrom = ["*"];
};
};
agents = {
defaults = {
model = {
primary = "zai/glm-5";
};
};
};
models = {
providers = {
zai = {
baseUrl = "https://api.z.ai/api/coding/paas/v4";
apiKey = "\${ZAI_API_KEY}";
api = "openai-completions";
models = [
{ id = "glm-4.7"; name = "GLM 4.7"; contextWindow = 128000; maxTokens = 131072; }
{ id = "glm-5"; name = "GLM 5"; contextWindow = 128000; maxTokens = 131072; }
{ id = "glm-5-turbo"; name = "GLM 5 Turbo"; contextWindow = 128000; maxTokens = 131072; }
{ id = "glm-4.5-air"; name = "GLM 4.5 Air"; contextWindow = 128000; maxTokens = 131072; }
{ id = "glm-4.7-flash"; name = "GLM 4.7 Flash"; contextWindow = 128000; maxTokens = 131072; }
];
};
};
};
};
};
}

View file

@ -0,0 +1,45 @@
{
"gateway": {
"port": 18789,
"bind": "0.0.0.0",
"trustedProxies": ["::1", "127.0.0.1", "10.88.0.0/16", "10.89.0.0/16"],
"auth": {
"mode": "none"
},
"controlUi": {
"dangerouslyAllowHostHeaderOriginFallback": true,
"allowedOrigins": ["*"]
}
},
"channels": {
"discord": {
"enabled": true,
"groupPolicy": "open",
"dmPolicy": "open",
"allowFrom": ["*"]
}
},
"agents": {
"defaults": {
"model": {
"primary": "zai/glm-5"
}
}
},
"models": {
"providers": {
"zai": {
"baseUrl": "https://api.z.ai/api/coding/paas/v4",
"apiKey": "${ZAI_API_KEY}",
"api": "openai-completions",
"models": [
{ "id": "glm-4.7", "name": "GLM 4.7", "contextWindow": 128000, "maxTokens": 131072 },
{ "id": "glm-5", "name": "GLM 5", "contextWindow": 128000, "maxTokens": 131072 },
{ "id": "glm-5-turbo", "name": "GLM 5 Turbo", "contextWindow": 128000, "maxTokens": 131072 },
{ "id": "glm-4.5-air", "name": "GLM 4.5 Air", "contextWindow": 128000, "maxTokens": 131072 },
{ "id": "glm-4.7-flash", "name": "GLM 4.7 Flash", "contextWindow": 128000, "maxTokens": 131072 }
]
}
}
}
}

View file

@ -47,7 +47,7 @@ in
config.sops.templates."openclaw.env".path
];
volumes = [
"${config.sops.templates."openclaw_config.json".path}:/root/.openclaw/config.json:ro"
"${./openclaw-config.json}:/root/.openclaw/config.json:ro"
"openclaw-data:/root/.openclaw"
];
extraOptions = [