diff options
Diffstat (limited to 'internal/appmeta/appmeta.go')
| -rw-r--r-- | internal/appmeta/appmeta.go | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/internal/appmeta/appmeta.go b/internal/appmeta/appmeta.go index 61ceb18..72c8afc 100644 --- a/internal/appmeta/appmeta.go +++ b/internal/appmeta/appmeta.go @@ -1,7 +1,7 @@ // Package appmeta stores the small amount of per-app networking config -// Skiff itself needs (IP, port, health check) that isn't already implied by -// jail.conf/rc.conf - a flat file living with the app's own data, not a -// separate control-plane database. +// Skiff itself needs (IP, port, health check, domains) that isn't already +// implied by jail.conf/rc.conf - a flat file living with the app's own +// data, not a separate control-plane database. package appmeta import ( @@ -9,11 +9,30 @@ import ( "os" ) +// Domain is one hostname routed to the app; every non-Primary one redirects +// to whichever is Primary. +type Domain struct { + Hostname string `json:"hostname"` + Primary bool `json:"primary"` +} + type Meta struct { - IP string `json:"ip"` - Port int `json:"port"` - HealthPath string `json:"health_path"` - ServerName string `json:"server_name"` + IP string `json:"ip"` + Port int `json:"port"` + HealthPath string `json:"health_path"` + Domains []Domain `json:"domains,omitempty"` + // Hostnames the app's cert actually covers as of the last sync - may + // lag Domains after an add (not yet issued) or a remove (not pruned). + TLSDomains []string `json:"tls_domains,omitempty"` +} + +func (m Meta) PrimaryDomain() (Domain, bool) { + for _, d := range m.Domains { + if d.Primary { + return d, true + } + } + return Domain{}, false } func Write(path string, m Meta) error { |
