|
|
|
|
@ -15,6 +15,7 @@ import (
|
|
|
|
|
"sync/atomic" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
gosundheit "github.com/AppsFlyer/go-sundheit" |
|
|
|
|
"github.com/felixge/httpsnoop" |
|
|
|
|
"github.com/gorilla/handlers" |
|
|
|
|
"github.com/gorilla/mux" |
|
|
|
|
@ -93,6 +94,8 @@ type Config struct {
|
|
|
|
|
Logger log.Logger |
|
|
|
|
|
|
|
|
|
PrometheusRegistry *prometheus.Registry |
|
|
|
|
|
|
|
|
|
HealthChecker gosundheit.Health |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// WebConfig holds the server's frontend templates and asset configuration.
|
|
|
|
|
@ -333,7 +336,13 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
|
|
|
|
|
// "authproxy" connector.
|
|
|
|
|
handleFunc("/callback/{connector}", s.handleConnectorCallback) |
|
|
|
|
handleFunc("/approval", s.handleApproval) |
|
|
|
|
handle("/healthz", s.newHealthChecker(ctx)) |
|
|
|
|
handle("/healthz", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
if !c.HealthChecker.IsHealthy() { |
|
|
|
|
s.renderError(r, w, http.StatusInternalServerError, "Health check failed.") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
fmt.Fprintf(w, "Health check passed") |
|
|
|
|
})) |
|
|
|
|
handlePrefix("/static", static) |
|
|
|
|
handlePrefix("/theme", theme) |
|
|
|
|
s.mux = r |
|
|
|
|
|