Fail server start up on partial prom config. (#4749)

* Fail server start up on partial prom config.

* tweaking error message a bit
This commit is contained in:
Raja Subramanian
2026-08-13 13:49:17 +05:30
committed by GitHub
parent d51533e25c
commit 2561589868
+5 -1
View File
@@ -155,7 +155,7 @@ func NewLivekitServer(conf *config.Config,
}
if conf.PrometheusPort > 0 {
logger.Warnw("prometheus_port is deprecated, please switch prometheus.port instead", nil)
logger.Warnw("prometheus_port is deprecated, please switch to prometheus.port instead", nil)
conf.Prometheus.Port = conf.PrometheusPort
}
@@ -166,6 +166,10 @@ func NewLivekitServer(conf *config.Config,
protectedHandler.Use(negroni.HandlerFunc(GenBasicAuthMiddleware(conf.Prometheus.Username, conf.Prometheus.Password)))
protectedHandler.UseHandler(promHandler)
promHandler = protectedHandler
} else if conf.Prometheus.Username != "" || conf.Prometheus.Password != "" {
logger.Warnw("prometheus username or password is set but not both, set both or nothing for unauthenticated access", nil)
err = errors.New("prometheus username or password is set but not both, set both or nothing for unauthenticated access")
return
}
s.promServer = &http.Server{
Handler: promHandler,