httpcaddyfile: Allow "admin off" option

This commit is contained in:
Matthew Holt 2020-02-27 21:04:06 -07:00
parent cef6e098bb
commit 03ab55b51a
1 changed files with 5 additions and 1 deletions

View File

@ -327,7 +327,11 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
&warnings) &warnings)
} }
if adminConfig, ok := options["admin"].(string); ok && adminConfig != "" { if adminConfig, ok := options["admin"].(string); ok && adminConfig != "" {
cfg.Admin = &caddy.AdminConfig{Listen: adminConfig} if adminConfig == "off" {
cfg.Admin = &caddy.AdminConfig{Disabled: true}
} else {
cfg.Admin = &caddy.AdminConfig{Listen: adminConfig}
}
} }
if len(customLogs) > 0 { if len(customLogs) > 0 {
if cfg.Logging == nil { if cfg.Logging == nil {