|
@ -169,9 +169,10 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock, |
|
|
|
|
|
|
|
|
// now that each server is configured, make the HTTP app
|
|
|
// now that each server is configured, make the HTTP app
|
|
|
httpApp := caddyhttp.App{ |
|
|
httpApp := caddyhttp.App{ |
|
|
HTTPPort: tryInt(options["http_port"], &warnings), |
|
|
HTTPPort: tryInt(options["http_port"], &warnings), |
|
|
HTTPSPort: tryInt(options["https_port"], &warnings), |
|
|
HTTPSPort: tryInt(options["https_port"], &warnings), |
|
|
Servers: servers, |
|
|
DefaultSNI: tryString(options["default_sni"], &warnings), |
|
|
|
|
|
Servers: servers, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// now for the TLS app! (TODO: refactor into own func)
|
|
|
// now for the TLS app! (TODO: refactor into own func)
|
|
@ -364,6 +365,8 @@ func (ServerType) evaluateGlobalOptionsBlock(serverBlocks []serverBlock, options |
|
|
val, err = parseOptHTTPPort(disp) |
|
|
val, err = parseOptHTTPPort(disp) |
|
|
case "https_port": |
|
|
case "https_port": |
|
|
val, err = parseOptHTTPSPort(disp) |
|
|
val, err = parseOptHTTPSPort(disp) |
|
|
|
|
|
case "default_sni": |
|
|
|
|
|
val, err = parseOptSingleString(disp) |
|
|
case "order": |
|
|
case "order": |
|
|
val, err = parseOptOrder(disp) |
|
|
val, err = parseOptOrder(disp) |
|
|
case "experimental_http3": |
|
|
case "experimental_http3": |
|
@ -371,9 +374,9 @@ func (ServerType) evaluateGlobalOptionsBlock(serverBlocks []serverBlock, options |
|
|
case "storage": |
|
|
case "storage": |
|
|
val, err = parseOptStorage(disp) |
|
|
val, err = parseOptStorage(disp) |
|
|
case "acme_ca", "acme_dns", "acme_ca_root": |
|
|
case "acme_ca", "acme_dns", "acme_ca_root": |
|
|
val, err = parseOptACME(disp) |
|
|
val, err = parseOptSingleString(disp) |
|
|
case "email": |
|
|
case "email": |
|
|
val, err = parseOptEmail(disp) |
|
|
val, err = parseOptSingleString(disp) |
|
|
case "admin": |
|
|
case "admin": |
|
|
val, err = parseOptAdmin(disp) |
|
|
val, err = parseOptAdmin(disp) |
|
|
case "debug": |
|
|
case "debug": |
|
@ -951,6 +954,14 @@ func tryInt(val interface{}, warnings *[]caddyconfig.Warning) int { |
|
|
return intVal |
|
|
return intVal |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func tryString(val interface{}, warnings *[]caddyconfig.Warning) string { |
|
|
|
|
|
stringVal, ok := val.(string) |
|
|
|
|
|
if val != nil && !ok && warnings != nil { |
|
|
|
|
|
*warnings = append(*warnings, caddyconfig.Warning{Message: "not a string type"}) |
|
|
|
|
|
} |
|
|
|
|
|
return stringVal |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// sliceContains returns true if needle is in haystack.
|
|
|
// sliceContains returns true if needle is in haystack.
|
|
|
func sliceContains(haystack []string, needle string) bool { |
|
|
func sliceContains(haystack []string, needle string) bool { |
|
|
for _, s := range haystack { |
|
|
for _, s := range haystack { |
|
|