diff options
author | Francis Lavoie <[email protected]> | 2022-05-08 21:32:10 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-08 21:32:10 -0400 |
commit | b687d7b9670890efd8dc065fb7a025cd0c3a1445 (patch) | |
tree | 960d78a77556744576732a330a73b8364b7154fb /caddyconfig/httpcaddyfile/options.go | |
parent | f7be0ee10131f25620a2f64af7e3ded43eae2049 (diff) | |
download | caddy-b687d7b9670890efd8dc065fb7a025cd0c3a1445.tar.gz caddy-b687d7b9670890efd8dc065fb7a025cd0c3a1445.zip |
httpcaddyfile: Support multiple values for `default_bind` (#4774)
* httpcaddyfile: Support multiple values for `default_bind`
* Fix ordering of server blocks
Diffstat (limited to 'caddyconfig/httpcaddyfile/options.go')
-rw-r--r-- | caddyconfig/httpcaddyfile/options.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/caddyconfig/httpcaddyfile/options.go b/caddyconfig/httpcaddyfile/options.go index 65b03389d..ad52a7b05 100644 --- a/caddyconfig/httpcaddyfile/options.go +++ b/caddyconfig/httpcaddyfile/options.go @@ -29,7 +29,7 @@ func init() { RegisterGlobalOption("debug", parseOptTrue) RegisterGlobalOption("http_port", parseOptHTTPPort) RegisterGlobalOption("https_port", parseOptHTTPSPort) - RegisterGlobalOption("default_bind", parseOptSingleString) + RegisterGlobalOption("default_bind", parseOptStringList) RegisterGlobalOption("grace_period", parseOptDuration) RegisterGlobalOption("default_sni", parseOptSingleString) RegisterGlobalOption("order", parseOptOrder) @@ -279,6 +279,15 @@ func parseOptSingleString(d *caddyfile.Dispenser, _ interface{}) (interface{}, e return val, nil } +func parseOptStringList(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) { + d.Next() // consume parameter name + val := d.RemainingArgs() + if len(val) == 0 { + return "", d.ArgErr() + } + return val, nil +} + func parseOptAdmin(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) { adminCfg := new(caddy.AdminConfig) for d.Next() { |