Explicitly pass DOMAIN_SUFFIX and CADDY_API_URL to build script

Environment inheritance from the server process was not reliably
propagating these vars into the spawned bash subprocess.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
Claude 2026-03-20 09:28:50 +00:00
parent f92545ed4e
commit ee78f3ff0a
No known key found for this signature in database

View file

@ -118,16 +118,21 @@ async fn run_build(state: &AppState, deploy_id: &str) -> anyhow::Result<()> {
)
.await?;
let domain_suffix = std::env::var("DOMAIN_SUFFIX").unwrap_or_else(|_| "localhost".into());
let caddy_api_url = std::env::var("CADDY_API_URL").unwrap_or_else(|_| "http://localhost:2019".into());
let mut child = Command::new("bash")
.arg(&build_script)
.env("APP_ID", &app.id)
.env("APP_NAME", &app.name)
.env("REPO_URL", &app.repo_url)
.env("BRANCH", &app.branch)
.env("PORT", app.port.to_string())
.env("ENV_FILE", &env_file)
.env("SHA", deploy.sha.as_deref().unwrap_or(""))
.env("BUILD_DIR", &build_dir)
.env("APP_ID", &app.id)
.env("APP_NAME", &app.name)
.env("REPO_URL", &app.repo_url)
.env("BRANCH", &app.branch)
.env("PORT", app.port.to_string())
.env("ENV_FILE", &env_file)
.env("SHA", deploy.sha.as_deref().unwrap_or(""))
.env("BUILD_DIR", &build_dir)
.env("DOMAIN_SUFFIX", &domain_suffix)
.env("CADDY_API_URL", &caddy_api_url)
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.spawn()