fix(config): apply env overrides at runtime and fix Docker compose defaults (#279)
- Call apply_env_overrides() after Config::load_or_init() in main.rs so environment variables (API_KEY, PROVIDER, ZEROCLAW_GATEWAY_PORT, etc.) are actually applied at runtime, not just in tests - Add ZEROCLAW_ALLOW_PUBLIC_BIND env var support for gateway bind policy - Fix docker-compose.yml: correct volume path (/zeroclaw-data not /data), add ZEROCLAW_ALLOW_PUBLIC_BIND=true for container networking, make host port configurable via HOST_PORT env var - Add docker-compose.override.yml to .gitignore for local dev overrides
This commit is contained in:
parent
ebdcee3a5d
commit
d5e8fc1652
4 changed files with 15 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@
|
||||||
*.db-journal
|
*.db-journal
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.wt-pr37/
|
.wt-pr37/
|
||||||
|
docker-compose.override.yml
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,19 @@ services:
|
||||||
# Options: openrouter, openai, anthropic, ollama
|
# Options: openrouter, openai, anthropic, ollama
|
||||||
- PROVIDER=${PROVIDER:-openrouter}
|
- PROVIDER=${PROVIDER:-openrouter}
|
||||||
|
|
||||||
|
# Allow public bind inside Docker (required for container networking)
|
||||||
|
- ZEROCLAW_ALLOW_PUBLIC_BIND=true
|
||||||
|
|
||||||
# Optional: Model override
|
# Optional: Model override
|
||||||
# - ZEROCLAW_MODEL=anthropic/claude-sonnet-4-20250514
|
# - ZEROCLAW_MODEL=anthropic/claude-sonnet-4-20250514
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
# Persist workspace and config
|
# Persist workspace and config (must match WORKDIR/HOME in Dockerfile)
|
||||||
- zeroclaw-data:/data
|
- zeroclaw-data:/zeroclaw-data
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
# Gateway API port
|
# Gateway API port (override HOST_PORT if 3000 is taken)
|
||||||
- "3000:3000"
|
- "${HOST_PORT:-3000}:3000"
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|
|
||||||
|
|
@ -1002,6 +1002,11 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow public bind: ZEROCLAW_ALLOW_PUBLIC_BIND
|
||||||
|
if let Ok(val) = std::env::var("ZEROCLAW_ALLOW_PUBLIC_BIND") {
|
||||||
|
self.gateway.allow_public_bind = val == "1" || val.eq_ignore_ascii_case("true");
|
||||||
|
}
|
||||||
|
|
||||||
// Temperature: ZEROCLAW_TEMPERATURE
|
// Temperature: ZEROCLAW_TEMPERATURE
|
||||||
if let Ok(temp_str) = std::env::var("ZEROCLAW_TEMPERATURE") {
|
if let Ok(temp_str) = std::env::var("ZEROCLAW_TEMPERATURE") {
|
||||||
if let Ok(temp) = temp_str.parse::<f64>() {
|
if let Ok(temp) = temp_str.parse::<f64>() {
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,8 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// All other commands need config loaded first
|
// All other commands need config loaded first
|
||||||
let config = Config::load_or_init()?;
|
let mut config = Config::load_or_init()?;
|
||||||
|
config.apply_env_overrides();
|
||||||
|
|
||||||
match cli.command {
|
match cli.command {
|
||||||
Commands::Onboard { .. } => unreachable!(),
|
Commands::Onboard { .. } => unreachable!(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue