Initial support for multiple server names#2829
Conversation
This is needed for matrix-org/dendrite#2829.
| func testFederationAPIJoinThenKeyUpdate(t *testing.T, dbType test.DBType) { | ||
| base, close := testrig.CreateBaseDendrite(t, dbType) | ||
| base.Cfg.FederationAPI.PreferDirectFetch = true | ||
| base.Cfg.FederationAPI.KeyPerspectives = nil |
There was a problem hiding this comment.
Mostly because I noticed the various key tests were configuring perspective servers, which just seemed surprising to me.
|
|
||
| v1fedmux.Handle("/user/keys/query", MakeFedAPI( | ||
| "federation_keys_query", cfg.Matrix.ServerName, keys, wakeup, | ||
| "federation_keys_query", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup, |
There was a problem hiding this comment.
How does this work given we are passing in a single server name for the destination?
There was a problem hiding this comment.
We pass in both the default server name and the check function into MakeFedAPI. If the X-Matrix header contains a destination= field then we will match it using cfg.Matrix.IsLocalServerName. If there is no destination= then we use the given server name as the default value.
| } | ||
|
|
||
| func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.PerformAccountCreationRequest, res *api.PerformAccountCreationResponse) error { | ||
| serverName := req.ServerName |
There was a problem hiding this comment.
We should probably validate this with the config as a sanity check at internal API boundaries like this.
There was a problem hiding this comment.
Yeah, these little bits in the user API are just stubs to keep things working until we've got columns in the tables to store server names in.
…g/dendrite into neilalexander/localservernames
This PR is the first step towards virtual hosting by laying the groundwork for multiple server names being configured.