summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/map/caddyfile.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/map/caddyfile.go')
-rw-r--r--modules/caddyhttp/map/caddyfile.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/caddyhttp/map/caddyfile.go b/modules/caddyhttp/map/caddyfile.go
index eb0c5ae..77d4c46 100644
--- a/modules/caddyhttp/map/caddyfile.go
+++ b/modules/caddyhttp/map/caddyfile.go
@@ -35,6 +35,9 @@ func init() {
// If the input value is prefixed with a tilde (~), then the input will be parsed as a
// regular expression.
//
+// The Caddyfile adapter treats outputs that are a literal hyphen (-) as a null/nil
+// value. This is useful if you want to fall back to default for that particular output.
+//
// The number of outputs for each mapping must not be more than the number of destinations.
// However, for convenience, there may be fewer outputs than destinations and any missing
// outputs will be filled in implicitly.
@@ -72,7 +75,11 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
in := h.Val()
var outs []interface{}
for _, out := range h.RemainingArgs() {
- outs = append(outs, out)
+ if out == "-" {
+ outs = append(outs, nil)
+ } else {
+ outs = append(outs, out)
+ }
}
// cannot have more outputs than destinations