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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user