mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
fix: write generated Caddyfile to disk only if succesfully loaded into local Caddy (means valid)
This commit is contained in:
@@ -54,6 +54,9 @@ https://{{$hostname}} {
|
||||
}
|
||||
log
|
||||
}{{end}}
|
||||
`
|
||||
caddyfileUnavailabeFooter = `# NOTE: User-defined configs for services were skipped because Caddy is not running on this machine
|
||||
# or the latest generated config is invalid. Please check the Caddy logs if it's running.
|
||||
`
|
||||
)
|
||||
|
||||
@@ -118,9 +121,7 @@ func (g *CaddyfileGenerator) Generate(
|
||||
}
|
||||
|
||||
if !includeCustom {
|
||||
return fmt.Sprintf("%s\n%s\n"+
|
||||
"# NOTE: User-defined configs for services were skipped because Caddy is not running on this machine.\n",
|
||||
caddyfileHeader, caddyfile), nil
|
||||
return fmt.Sprintf("%s\n%s\n%s", caddyfileHeader, caddyfile, caddyfileUnavailabeFooter), nil
|
||||
}
|
||||
|
||||
upstreams := serviceUpstreams(containers)
|
||||
|
||||
Reference in New Issue
Block a user