summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
diff options
context:
space:
mode:
Diffstat (limited to 'caddyconfig/httpcaddyfile')
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go5
-rw-r--r--caddyconfig/httpcaddyfile/options.go14
2 files changed, 19 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index bc546b4..05022d1 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -74,6 +74,8 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
val, err = parseOptACMECA(disp)
case "email":
val, err = parseOptEmail(disp)
+ case "admin":
+ val, err = parseOptAdmin(disp)
default:
return nil, warnings, fmt.Errorf("unrecognized parameter name: %s", dir)
}
@@ -254,6 +256,9 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
storageCvtr.(caddy.Module).CaddyModule().ID(),
&warnings)
}
+ if adminConfig, ok := options["admin"].(string); ok && adminConfig != "" {
+ cfg.Admin = &caddy.AdminConfig{Listen: adminConfig}
+ }
return cfg, warnings, nil
}
diff --git a/caddyconfig/httpcaddyfile/options.go b/caddyconfig/httpcaddyfile/options.go
index a60d060..74ec507 100644
--- a/caddyconfig/httpcaddyfile/options.go
+++ b/caddyconfig/httpcaddyfile/options.go
@@ -132,3 +132,17 @@ func parseOptEmail(d *caddyfile.Dispenser) (string, error) {
}
return val, nil
}
+
+func parseOptAdmin(d *caddyfile.Dispenser) (string, error) {
+ if d.Next() {
+ var listenAddress string
+ d.AllArgs(&listenAddress)
+
+ if listenAddress == "" {
+ listenAddress = caddy.DefaultAdminListen
+ }
+
+ return listenAddress, nil
+ }
+ return "", nil
+}