mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 23:03:10 -06:00
Use SetupAndServe instead of AddHealthCheck
This commit is contained in:
parent
3af5faa592
commit
47b7828a96
|
|
@ -29,11 +29,11 @@ func main() {
|
||||||
|
|
||||||
intAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
intAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
||||||
appservice.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
appservice.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.AppServiceAPI.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.AppServiceAPI.InternalAPI.Listen,
|
base.Cfg.AppServiceAPI.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.AppServiceAPI.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ func main() {
|
||||||
intAPI.SetUserAPI(base.UserAPIClient())
|
intAPI.SetUserAPI(base.UserAPIClient())
|
||||||
|
|
||||||
keyserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
keyserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.KeyServer.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.KeyServer.InternalAPI.Listen,
|
base.Cfg.KeyServer.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.KeyServer.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ func main() {
|
||||||
client := base.CreateClient()
|
client := base.CreateClient()
|
||||||
|
|
||||||
mediaapi.AddPublicRoutes(base.PublicMediaAPIMux, &base.Cfg.MediaAPI, userAPI, client)
|
mediaapi.AddPublicRoutes(base.PublicMediaAPIMux, &base.Cfg.MediaAPI, userAPI, client)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.MediaAPI.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.MediaAPI.InternalAPI.Listen,
|
base.Cfg.MediaAPI.InternalAPI.Listen,
|
||||||
base.Cfg.MediaAPI.ExternalAPI.Listen,
|
base.Cfg.MediaAPI.ExternalAPI.Listen,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.MediaAPI.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func main() {
|
||||||
base.PublicMediaAPIMux,
|
base.PublicMediaAPIMux,
|
||||||
)
|
)
|
||||||
|
|
||||||
setup.AddHealthCheck(base.InternalAPIMux,
|
dbConfigs := []config.DatabaseOptions{
|
||||||
base.Cfg.AppServiceAPI.Database,
|
base.Cfg.AppServiceAPI.Database,
|
||||||
base.Cfg.FederationSender.Database,
|
base.Cfg.FederationSender.Database,
|
||||||
base.Cfg.KeyServer.Database,
|
base.Cfg.KeyServer.Database,
|
||||||
|
|
@ -154,7 +154,7 @@ func main() {
|
||||||
base.Cfg.SyncAPI.Database,
|
base.Cfg.SyncAPI.Database,
|
||||||
base.Cfg.UserAPI.AccountDatabase,
|
base.Cfg.UserAPI.AccountDatabase,
|
||||||
base.Cfg.UserAPI.DeviceDatabase,
|
base.Cfg.UserAPI.DeviceDatabase,
|
||||||
)
|
}
|
||||||
|
|
||||||
// Expose the matrix APIs directly rather than putting them under a /api path.
|
// Expose the matrix APIs directly rather than putting them under a /api path.
|
||||||
go func() {
|
go func() {
|
||||||
|
|
@ -162,6 +162,7 @@ func main() {
|
||||||
config.HTTPAddress(httpAddr), // internal API
|
config.HTTPAddress(httpAddr), // internal API
|
||||||
config.HTTPAddress(httpAddr), // external API
|
config.HTTPAddress(httpAddr), // external API
|
||||||
nil, nil, // TLS settings
|
nil, nil, // TLS settings
|
||||||
|
dbConfigs..., // used in health checks
|
||||||
)
|
)
|
||||||
}()
|
}()
|
||||||
// Handle HTTPS if certificate and key are provided
|
// Handle HTTPS if certificate and key are provided
|
||||||
|
|
@ -171,6 +172,7 @@ func main() {
|
||||||
config.HTTPAddress(httpsAddr), // internal API
|
config.HTTPAddress(httpsAddr), // internal API
|
||||||
config.HTTPAddress(httpsAddr), // external API
|
config.HTTPAddress(httpsAddr), // external API
|
||||||
certFile, keyFile, // TLS settings
|
certFile, keyFile, // TLS settings
|
||||||
|
dbConfigs..., // used in health checks
|
||||||
)
|
)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@ func main() {
|
||||||
rsAPI := roomserver.NewInternalAPI(base, keyRing)
|
rsAPI := roomserver.NewInternalAPI(base, keyRing)
|
||||||
rsAPI.SetFederationSenderAPI(fsAPI)
|
rsAPI.SetFederationSenderAPI(fsAPI)
|
||||||
roomserver.AddInternalRoutes(base.InternalAPIMux, rsAPI)
|
roomserver.AddInternalRoutes(base.InternalAPIMux, rsAPI)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.RoomServer.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.RoomServer.InternalAPI.Listen,
|
base.Cfg.RoomServer.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.RoomServer.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ func main() {
|
||||||
|
|
||||||
intAPI := serverkeyapi.NewInternalAPI(&base.Cfg.ServerKeyAPI, federation, base.Caches)
|
intAPI := serverkeyapi.NewInternalAPI(&base.Cfg.ServerKeyAPI, federation, base.Caches)
|
||||||
serverkeyapi.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
|
serverkeyapi.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.ServerKeyAPI.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.ServerKeyAPI.InternalAPI.Listen,
|
base.Cfg.ServerKeyAPI.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.ServerKeyAPI.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ func main() {
|
||||||
base.KeyServerHTTPClient(),
|
base.KeyServerHTTPClient(),
|
||||||
federation, &cfg.SyncAPI,
|
federation, &cfg.SyncAPI,
|
||||||
)
|
)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.SyncAPI.Database)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.SyncAPI.InternalAPI.Listen,
|
base.Cfg.SyncAPI.InternalAPI.Listen,
|
||||||
base.Cfg.SyncAPI.ExternalAPI.Listen,
|
base.Cfg.SyncAPI.ExternalAPI.Listen,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
base.Cfg.SyncAPI.Database,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ func main() {
|
||||||
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, base.KeyServerHTTPClient())
|
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, base.KeyServerHTTPClient())
|
||||||
|
|
||||||
userapi.AddInternalRoutes(base.InternalAPIMux, userAPI)
|
userapi.AddInternalRoutes(base.InternalAPIMux, userAPI)
|
||||||
setup.AddHealthCheck(base.InternalAPIMux, cfg.UserAPI.AccountDatabase, cfg.UserAPI.DeviceDatabase)
|
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.UserAPI.InternalAPI.Listen,
|
base.Cfg.UserAPI.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
|
cfg.UserAPI.AccountDatabase, cfg.UserAPI.DeviceDatabase,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue