mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-26 15:08:28 +00:00
Update startup logic for HTTP mode
This commit is contained in:
parent
60af5bee47
commit
51ba578f96
1 changed files with 15 additions and 16 deletions
|
@ -109,22 +109,15 @@ func main() {
|
||||||
federationsender.AddInternalRoutes(base.InternalAPIMux, fsAPI)
|
federationsender.AddInternalRoutes(base.InternalAPIMux, fsAPI)
|
||||||
fsAPI = base.FederationSenderHTTPClient()
|
fsAPI = base.FederationSenderHTTPClient()
|
||||||
}
|
}
|
||||||
// The underlying roomserver implementation needs to be able to call the fedsender.
|
|
||||||
// This is different to rsAPI which can be the http client which doesn't need this dependency
|
|
||||||
rsImpl.SetFederationSenderAPI(fsAPI)
|
|
||||||
|
|
||||||
keyAPI := keyserver.NewInternalAPI(base, &base.Cfg.KeyServer, fsAPI)
|
keyImpl := keyserver.NewInternalAPI(base, &base.Cfg.KeyServer, fsAPI)
|
||||||
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, keyAPI)
|
keyAPI := keyImpl
|
||||||
|
|
||||||
// The appservice might try to create a new service account on startup, which will fail if running in httpapi mode
|
|
||||||
// since there won't be an userapi endpoint yet, so move this before switching to httpapi mode.
|
|
||||||
asAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
|
||||||
if base.UseHTTPAPIs {
|
if base.UseHTTPAPIs {
|
||||||
appservice.AddInternalRoutes(base.InternalAPIMux, asAPI)
|
keyserver.AddInternalRoutes(base.InternalAPIMux, keyAPI)
|
||||||
asAPI = base.AppserviceHTTPClient()
|
keyAPI = base.KeyServerHTTPClient()
|
||||||
}
|
}
|
||||||
rsAPI.SetAppserviceAPI(asAPI)
|
|
||||||
|
|
||||||
|
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, keyAPI)
|
||||||
if base.UseHTTPAPIs {
|
if base.UseHTTPAPIs {
|
||||||
userapi.AddInternalRoutes(base.InternalAPIMux, userAPI)
|
userapi.AddInternalRoutes(base.InternalAPIMux, userAPI)
|
||||||
userAPI = base.UserAPIClient()
|
userAPI = base.UserAPIClient()
|
||||||
|
@ -134,14 +127,20 @@ func main() {
|
||||||
Impl: userAPI,
|
Impl: userAPI,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyAPI.SetUserAPI(userAPI)
|
|
||||||
|
|
||||||
// needs to be after the SetUserAPI call above
|
asAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
||||||
if base.UseHTTPAPIs {
|
if base.UseHTTPAPIs {
|
||||||
keyserver.AddInternalRoutes(base.InternalAPIMux, keyAPI)
|
appservice.AddInternalRoutes(base.InternalAPIMux, asAPI)
|
||||||
keyAPI = base.KeyServerHTTPClient()
|
asAPI = base.AppserviceHTTPClient()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The underlying roomserver implementation needs to be able to call the fedsender.
|
||||||
|
// This is different to rsAPI which can be the http client which doesn't need this
|
||||||
|
// dependency. Other components also need updating after their dependencies are up.
|
||||||
|
rsImpl.SetFederationSenderAPI(fsAPI)
|
||||||
|
rsImpl.SetAppserviceAPI(asAPI)
|
||||||
|
keyImpl.SetUserAPI(userAPI)
|
||||||
|
|
||||||
eduInputAPI := eduserver.NewInternalAPI(
|
eduInputAPI := eduserver.NewInternalAPI(
|
||||||
base, cache.New(), userAPI,
|
base, cache.New(), userAPI,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue