diff --git a/internal/basecomponent/base.go b/internal/basecomponent/base.go index 57b4e476c..a48323726 100644 --- a/internal/basecomponent/base.go +++ b/internal/basecomponent/base.go @@ -154,11 +154,11 @@ func (b *BaseDendrite) CreateHTTPFederationSenderAPIs() federationSenderAPI.Fede return f } -// CreateHTTPFederationSenderAPIs returns FederationSenderInternalAPI for hitting -// the federation sender over HTTP +// CreateHTTPServerKeyAPIs returns ServerKeyInternalAPI for hitting the server key +// API over HTTP func (b *BaseDendrite) CreateHTTPServerKeyAPIs() serverKeyAPI.ServerKeyInternalAPI { f, err := serverKeyAPI.NewServerKeyInternalAPIHTTP( - b.Cfg.FederationSenderURL(), + b.Cfg.ServerKeyAPIURL(), b.httpClient, b.ImmutableCache, ) diff --git a/internal/config/config.go b/internal/config/config.go index 7eeb67886..1fd083d0a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -753,6 +753,15 @@ func (config *Dendrite) FederationSenderURL() string { return "http://" + string(config.Listen.FederationSender) } +// FederationSenderURL returns an HTTP URL for where the federation sender is listening. +func (config *Dendrite) ServerKeyAPIURL() string { + // Hard code the server key API server to talk HTTP for now. + // If we support HTTPS we need to think of a practical way to do certificate validation. + // People setting up servers shouldn't need to get a certificate valid for the public + // internet for an internal API. + return "http://" + string(config.Listen.ServerKeyAPI) +} + // SetupTracing configures the opentracing using the supplied configuration. func (config *Dendrite) SetupTracing(serviceName string) (closer io.Closer, err error) { if !config.Tracing.Enabled {