mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 05:13:11 -06:00
Tidy up
This commit is contained in:
parent
5199cb5cee
commit
a7ac34dad6
|
|
@ -178,13 +178,10 @@ func main() {
|
|||
publicroomsapi.SetupPublicRoomsAPIComponent(&base.Base, deviceDB, publicRoomsDB, rsAPI, federation, nil) // Check this later
|
||||
syncapi.SetupSyncAPIComponent(&base.Base, deviceDB, accountDB, rsAPI, federation, &cfg)
|
||||
|
||||
httpHandler := internal.WrapHandlerInCORS(base.Base.PublicAPIMux)
|
||||
|
||||
// Set up the API endpoints we handle. /metrics is for prometheus, and is
|
||||
// not wrapped by CORS, while everything else is
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
http.Handle("/_matrix", httpHandler)
|
||||
http.Handle("/_matrix", httpHandler)
|
||||
http.Handle("/_matrix", internal.WrapHandlerInCORS(base.Base.PublicAPIMux))
|
||||
if base.Base.EnableHTTPAPIs {
|
||||
http.Handle("/api/", base.Base.InternalAPIMux)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,14 +91,12 @@ func main() {
|
|||
publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, federation, nil)
|
||||
syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg)
|
||||
|
||||
httpHandler := internal.WrapHandlerInCORS(base.PublicAPIMux)
|
||||
|
||||
// Set up the API endpoints we handle. /metrics is for prometheus, and is
|
||||
// not wrapped by CORS, while everything else is
|
||||
if cfg.Metrics.Enabled {
|
||||
http.Handle("/metrics", internal.WrapHandlerInBasicAuth(promhttp.Handler(), cfg.Metrics.BasicAuth))
|
||||
}
|
||||
http.Handle("/_matrix", httpHandler)
|
||||
http.Handle("/_matrix", internal.WrapHandlerInCORS(base.PublicAPIMux))
|
||||
if base.EnableHTTPAPIs {
|
||||
http.Handle("/api/", base.InternalAPIMux)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,8 +227,7 @@ func main() {
|
|||
publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, federation, p2pPublicRoomProvider)
|
||||
syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg)
|
||||
|
||||
httpHandler := internal.WrapHandlerInCORS(base.PublicAPIMux)
|
||||
http.Handle("/_matrix", httpHandler)
|
||||
http.Handle("/_matrix", internal.WrapHandlerInCORS(base.PublicAPIMux))
|
||||
if base.EnableHTTPAPIs {
|
||||
http.Handle("/api/", base.InternalAPIMux)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ func (b *BaseDendrite) SetupAndServeHTTP(bindaddr string, listenaddr string) {
|
|||
|
||||
internal.SetupHTTPAPI(
|
||||
http.DefaultServeMux,
|
||||
internal.WrapHandlerInCORS(b.PublicAPIMux),
|
||||
b.PublicAPIMux,
|
||||
b.InternalAPIMux,
|
||||
b.Cfg,
|
||||
b.EnableHTTPAPIs,
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ func SetupHTTPAPI(servMux *http.ServeMux, publicApiMux http.Handler, internalApi
|
|||
if enableHTTPAPIs {
|
||||
servMux.Handle("/api/", internalApiMux)
|
||||
}
|
||||
servMux.Handle("/_matrix", publicApiMux)
|
||||
servMux.Handle("/_matrix", WrapHandlerInCORS(publicApiMux))
|
||||
}
|
||||
|
||||
// WrapHandlerInBasicAuth adds basic auth to a handler. Only used for /metrics
|
||||
|
|
|
|||
Loading…
Reference in a new issue