chore: add header to generated Caddyfile that it's autogenerated

This commit is contained in:
Pasha Sviderski
2025-08-21 08:54:06 +10:00
parent 813c397644
commit c01365b416
2 changed files with 69 additions and 10 deletions
+7 -2
View File
@@ -17,7 +17,11 @@ import (
"github.com/psviderski/uncloud/pkg/api"
)
const caddyfileTemplate = `http:// {
const (
caddyfileHeader = `# This file is autogenerated by Uncloud. Do not edit manually.
# Any manual changes will be overwritten on the next update.
`
caddyfileTemplate = `http:// {
handle {{.VerifyPath}} {
respond "{{.VerifyResponse}}" 200
}
@@ -47,6 +51,7 @@ https://{{$hostname}} {
log
}{{end}}
`
)
// CaddyfileGenerator generates a Caddyfile configuration for the Caddy reverse proxy.
type CaddyfileGenerator struct {
@@ -188,7 +193,7 @@ func (g *CaddyfileGenerator) Generate(ctx context.Context, records []store.Conta
}
}
return caddyfile, nil
return caddyfileHeader + "\n" + caddyfile, nil
}
func (g *CaddyfileGenerator) generateBaseFromPorts(containers []api.ServiceContainer) (string, error) {