diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-08-21 10:46:35 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-08-21 10:46:35 -0600 |
commit | c9980fd3671d873a7197a5ac4d6ac9d6b046abb6 (patch) | |
tree | 75c301ab10590fb5f7d5b869a3424b8d46176bbf /caddyconfig/caddyfile/adapter.go | |
parent | c4159ef76d279d6a84257b24dbe97430af32eb1e (diff) |
Refactor Caddyfile adapter and module registration
Use piles from which to draw config values.
Module values can return their name, so now we can do two-way mapping
from value to name and name to value; whereas before we could only map
name to value. This was problematic with the Caddyfile adapter since
it receives values and needs to know the name to put in the config.
Diffstat (limited to 'caddyconfig/caddyfile/adapter.go')
-rw-r--r-- | caddyconfig/caddyfile/adapter.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/caddyconfig/caddyfile/adapter.go b/caddyconfig/caddyfile/adapter.go index ab4905a..377f77b 100644 --- a/caddyconfig/caddyfile/adapter.go +++ b/caddyconfig/caddyfile/adapter.go @@ -37,14 +37,12 @@ func (a Adapter) Adapt(body []byte, options map[string]string) ([]byte, []caddyc options = make(map[string]string) } - directives := a.ServerType.ValidDirectives() - filename := options["filename"] if filename == "" { filename = "Caddyfile" } - serverBlocks, err := Parse(filename, bytes.NewReader(body), directives) + serverBlocks, err := Parse(filename, bytes.NewReader(body)) if err != nil { return nil, nil, err } @@ -77,10 +75,6 @@ type Unmarshaler interface { // ServerType is a type that can evaluate a Caddyfile and set up a caddy config. type ServerType interface { - // ValidDirectives returns a list of the - // server type's recognized directives. - ValidDirectives() []string - // Setup takes the server blocks which // contain tokens, as well as options // (e.g. CLI flags) and creates a Caddy |