mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-27 11:33:33 +00:00
chore: trim spaces for x-caddy, diff Caddy configs when comparing service specs
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
package api
|
||||
|
||||
import "strings"
|
||||
|
||||
// CaddySpec is the Caddy reverse proxy configuration for a service.
|
||||
type CaddySpec struct {
|
||||
// Config contains the Caddy config (Caddyfile) content. It must not conflict with the Caddy configs
|
||||
// of other services.
|
||||
Config string
|
||||
}
|
||||
|
||||
func (c *CaddySpec) Equals(other *CaddySpec) bool {
|
||||
if c == nil {
|
||||
return other == nil || strings.TrimSpace(other.Config) == ""
|
||||
}
|
||||
if other == nil {
|
||||
return strings.TrimSpace(c.Config) == ""
|
||||
}
|
||||
|
||||
return strings.TrimSpace(c.Config) == strings.TrimSpace(other.Config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user