mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-09 07:29:03 -04:00
load module & initialize RoundTripper - barebones
This commit is contained in:
parent
c92e374cd9
commit
d2762c8405
@ -90,7 +90,10 @@ type ActiveHealthChecks struct {
|
|||||||
// this value is ignored.
|
// this value is ignored.
|
||||||
Port int `json:"port,omitempty"`
|
Port int `json:"port,omitempty"`
|
||||||
|
|
||||||
// The transport to use for health checks. If not set, the handler's transport is used
|
|
||||||
|
// Configures the method of transport for the active health checker.
|
||||||
|
// The default transport is the handler's transport
|
||||||
|
TransportRaw json.RawMessage `json:"transport,omitempty"`
|
||||||
Transport http.RoundTripper `json:"transport,omitempty"`
|
Transport http.RoundTripper `json:"transport,omitempty"`
|
||||||
|
|
||||||
// HTTP headers to set on health check requests.
|
// HTTP headers to set on health check requests.
|
||||||
@ -177,9 +180,15 @@ func (a *ActiveHealthChecks) Provision(ctx caddy.Context, h *Handler) error {
|
|||||||
}
|
}
|
||||||
a.uri = parsedURI
|
a.uri = parsedURI
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use handler's transport if no active one set
|
// Use handler's transport if no active one set
|
||||||
if a.Transport == nil {
|
if a.TransportRaw != nil {
|
||||||
|
mod, err := ctx.LoadModule(a, "TransportRaw")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("loading transport: %v", err)
|
||||||
|
}
|
||||||
|
a.Transport = mod.(http.RoundTripper)
|
||||||
|
} else {
|
||||||
a.Transport = h.Transport
|
a.Transport = h.Transport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user