Add new env. variables and options - HTTP_BASE_URL to control URL prefix, defaults to / - HTTP_SSL_TERMINATED to explicitly set if Corteza is running behind HTTPS Refresh and document webapp/Makefile with more dev tasks Fix all absolute URLs in applications, logos, icons Improve logic behind integrated webapp serving, inject/replace <base href> tag according to URL prefix Prevent mounting api & webapps to the same base
25 lines
620 B
Go
25 lines
620 B
Go
package server
|
|
|
|
import (
|
|
"github.com/99designs/basicauth-go"
|
|
"net/http"
|
|
|
|
"github.com/766b/chi-prometheus"
|
|
"github.com/go-chi/chi"
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
// MetricsMiddleware is the request logger that provides metrics to prometheus
|
|
func metricsMiddleware(name string) func(http.Handler) http.Handler {
|
|
return chiprometheus.NewMiddleware(name)
|
|
}
|
|
|
|
func metricsMount(r chi.Router, username, password string) {
|
|
r.Route("/metrics", func(r chi.Router) {
|
|
r.Use(basicauth.New("Metrics", map[string][]string{
|
|
username: {password},
|
|
}))
|
|
r.Handle("/", promhttp.Handler())
|
|
})
|
|
}
|