From af25f0254e94eb2e2898ba495bfc3de209a49e79 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 22 Aug 2019 13:38:37 -0600 Subject: caddyfile: Support global config block; allow non-empty blocks w/ 0 keys --- caddyconfig/caddyfile/adapter.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'caddyconfig/caddyfile/adapter.go') diff --git a/caddyconfig/caddyfile/adapter.go b/caddyconfig/caddyfile/adapter.go index 377f77b..7a96e88 100644 --- a/caddyconfig/caddyfile/adapter.go +++ b/caddyconfig/caddyfile/adapter.go @@ -29,15 +29,15 @@ type Adapter struct { } // Adapt converts the Caddyfile config in body to Caddy JSON. -func (a Adapter) Adapt(body []byte, options map[string]string) ([]byte, []caddyconfig.Warning, error) { +func (a Adapter) Adapt(body []byte, options map[string]interface{}) ([]byte, []caddyconfig.Warning, error) { if a.ServerType == nil { return nil, nil, fmt.Errorf("no server type") } if options == nil { - options = make(map[string]string) + options = make(map[string]interface{}) } - filename := options["filename"] + filename, _ := options["filename"].(string) if filename == "" { filename = "Caddyfile" } @@ -80,7 +80,7 @@ type ServerType interface { // (e.g. CLI flags) and creates a Caddy // config, along with any warnings or // an error. - Setup([]ServerBlock, map[string]string) (*caddy.Config, []caddyconfig.Warning, error) + Setup([]ServerBlock, map[string]interface{}) (*caddy.Config, []caddyconfig.Warning, error) } // Interface guard -- cgit v1.2.3