Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Initial support for multiple server names#2829

Merged
neilalexander merged 16 commits into
mainfrom
neilalexander/localservernames
Oct 26, 2022
Merged

Initial support for multiple server names#2829
neilalexander merged 16 commits into
mainfrom
neilalexander/localservernames

Conversation

@neilalexander
Copy link
Copy Markdown
Contributor

This PR is the first step towards virtual hosting by laying the groundwork for multiple server names being configured.

@neilalexander neilalexander marked this pull request as ready for review October 25, 2022 13:06
@neilalexander neilalexander requested a review from a team as a code owner October 25, 2022 13:06
neilalexander added a commit to matrix-org/gomatrixserverlib that referenced this pull request Oct 25, 2022
Comment thread clientapi/routing/profile.go
func testFederationAPIJoinThenKeyUpdate(t *testing.T, dbType test.DBType) {
base, close := testrig.CreateBaseDendrite(t, dbType)
base.Cfg.FederationAPI.PreferDirectFetch = true
base.Cfg.FederationAPI.KeyPerspectives = nil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work given we are passing in a single server name for the destination?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread userapi/internal/api.go
}

func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.PerformAccountCreationRequest, res *api.PerformAccountCreationResponse) error {
serverName := req.ServerName
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably validate this with the config as a sanity check at internal API boundaries like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread userapi/internal/api.go
@neilalexander neilalexander merged commit f6dea71 into main Oct 26, 2022
@neilalexander neilalexander deleted the neilalexander/localservernames branch October 26, 2022 11:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants