Rearrange dependencies to avoid nil queryer

- A few commits ago we moved `Queryer` to be init when fed API is set
- This causes Queryer to be nil before it is set
- Causes nil error in `userapi.NewInternalAPI`
- Rearrange to avoid this
This commit is contained in:
Sam Wedgwood 2023-07-06 12:30:27 +01:00
parent b9e5e5494d
commit 8642e69568

View file

@ -157,13 +157,14 @@ func main() {
keyRing := fsAPI.KeyRing()
userAPI := userapi.NewInternalAPI(processCtx, cfg, cm, &natsInstance, rsAPI, federationClient)
asAPI := appservice.NewInternalAPI(processCtx, cfg, &natsInstance, userAPI, rsAPI)
// 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.
rsAPI.SetFederationAPI(fsAPI, keyRing)
userAPI := userapi.NewInternalAPI(processCtx, cfg, cm, &natsInstance, rsAPI, federationClient)
asAPI := appservice.NewInternalAPI(processCtx, cfg, &natsInstance, userAPI, rsAPI)
rsAPI.SetAppserviceAPI(asAPI)
rsAPI.SetUserAPI(userAPI)