diff options
author | Mark Sargent <99003+sarge@users.noreply.github.com> | 2020-03-05 05:58:49 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 09:58:49 -0700 |
commit | 26fb8b3efd671a02a92ee55e93f547606285cde4 (patch) | |
tree | e11624c59e70f17bf69ea70a6b800cd3daf12b99 /caddyconfig/httpcaddyfile/httptype.go | |
parent | e6c6210772ded5e07a9c730d22902c99d30631e2 (diff) |
httpcaddyfile: remove certificate tags from global state (#3111)
* remove the certificate tag tracking from global state
* refactored helper state, added log counter
* moved state initialisation close to where it is used.
* added helper state comment
Diffstat (limited to 'caddyconfig/httpcaddyfile/httptype.go')
-rw-r--r-- | caddyconfig/httpcaddyfile/httptype.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 89375db..685c7de 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -42,6 +42,7 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock, options map[string]interface{}) (*caddy.Config, []caddyconfig.Warning, error) { var warnings []caddyconfig.Warning gc := counter{new(int)} + state := make(map[string]interface{}) // load all the server blocks and associate them with a "pile" // of config values; also prohibit duplicate keys because they @@ -133,14 +134,17 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock, return nil, warnings, fmt.Errorf("%s:%d: unrecognized directive: %s", tkn.File, tkn.Line, dir) } - results, err := dirFunc(Helper{ + h := Helper{ Dispenser: caddyfile.NewDispenser(segment), options: options, warnings: &warnings, matcherDefs: matcherDefs, parentBlock: sb.block, groupCounter: gc, - }) + State: state, + } + + results, err := dirFunc(h) if err != nil { return nil, warnings, fmt.Errorf("parsing caddyfile tokens for '%s': %v", dir, err) } |