diff options
author | Matthew Holt <[email protected]> | 2019-05-22 12:32:36 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-05-22 12:32:36 -0600 |
commit | bc00d840e845d42145954839b88f1e836cd51bfd (patch) | |
tree | 0cd9f1103f3056fbadede6fd7de12ec605f50c02 /modules/caddyhttp/caddyhttp.go | |
parent | be9b6e7b57d5bbf13d26b1620d34efc4e12284f7 (diff) | |
download | caddy-bc00d840e845d42145954839b88f1e836cd51bfd.tar.gz caddy-bc00d840e845d42145954839b88f1e836cd51bfd.zip |
Export types and fields necessary to build configs (for config adapters)
Also flag most fields with 'omitempty' for JSON marshaling
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r-- | modules/caddyhttp/caddyhttp.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index 09a130e17..2b194cd9c 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -32,10 +32,10 @@ func init() { // App is the HTTP app for Caddy. type App struct { - HTTPPort int `json:"http_port"` - HTTPSPort int `json:"https_port"` - GracePeriod caddy2.Duration `json:"grace_period"` - Servers map[string]*Server `json:"servers"` + HTTPPort int `json:"http_port,omitempty"` + HTTPSPort int `json:"https_port,omitempty"` + GracePeriod caddy2.Duration `json:"grace_period,omitempty"` + Servers map[string]*Server `json:"servers,omitempty"` servers []*http.Server @@ -188,7 +188,7 @@ func (app *App) automaticHTTPS() error { domainSet := make(map[string]struct{}) for _, route := range srv.Routes { for _, m := range route.matchers { - if hm, ok := m.(*matchHost); ok { + if hm, ok := m.(*MatchHost); ok { for _, d := range *hm { if !certmagic.HostQualifies(d) { continue @@ -246,8 +246,8 @@ func (app *App) automaticHTTPS() error { redirRoutes = append(redirRoutes, ServerRoute{ matchers: []RequestMatcher{ - matchProtocol("http"), - matchHost(domains), + MatchProtocol("http"), + MatchHost(domains), }, responder: Static{ StatusCode: http.StatusTemporaryRedirect, // TODO: use permanent redirect instead |