API setup refactoring (#1266)

* Start HTTP endpoint refactoring

* Update SetupAndServeHTTP

* Fix builds

* Don't set up external listener if no address configured

* TLS HTTP setup

* Break apart client/federation/key/media muxes

* Tweaks

* Fix P2P demos

* Fix media API routing

* Review comments @Kegsay

* Update sample config

* Fix gobind build

* Fix External -> Public in federation API test
This commit is contained in:
Neil Alexander 2020-08-13 12:16:37 +01:00 committed by GitHub
parent 820c56c165
commit 9677a95afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 542 additions and 383 deletions

View file

@ -30,9 +30,14 @@ func main() {
rsAPI := base.RoomserverHTTPClient()
syncapi.AddPublicRoutes(
base.PublicAPIMux, base.KafkaConsumer, userAPI, rsAPI, base.KeyServerHTTPClient(), base.CurrentStateAPIClient(),
federation, &cfg.SyncAPI)
base.SetupAndServeHTTP(string(base.Cfg.SyncAPI.Bind), string(base.Cfg.SyncAPI.Listen))
base.PublicClientAPIMux, base.KafkaConsumer, userAPI, rsAPI,
base.KeyServerHTTPClient(), base.CurrentStateAPIClient(),
federation, &cfg.SyncAPI,
)
base.SetupAndServeHTTP(
base.Cfg.SyncAPI.InternalAPI.Listen,
setup.NoExternalListener,
nil, nil,
)
}