Move setting up the api mux to outside the routing.Setup functions. (#173)

This makes it possible to setup all the component APIs on a single http
listener which is necessary if we want to combine all the components
into a single monolith.
This commit is contained in:
Mark Haines 2017-08-03 15:10:39 +01:00 committed by GitHub
parent 3b07633326
commit 4975eb9074
10 changed files with 42 additions and 32 deletions

View file

@ -19,6 +19,7 @@ import (
"net/http"
"os"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/clientapi/auth/storage/accounts"
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
"github.com/matrix-org/dendrite/clientapi/consumers"
@ -102,10 +103,14 @@ func main() {
}
log.Info("Starting client API server on ", cfg.Listen.ClientAPI)
api := mux.NewRouter()
routing.Setup(
http.DefaultServeMux, http.DefaultClient, *cfg, roomserverProducer,
api, http.DefaultClient, *cfg, roomserverProducer,
queryAPI, aliasAPI, accountDB, deviceDB, federation, keyRing,
userUpdateProducer, syncProducer,
)
common.SetupHTTPAPI(http.DefaultServeMux, api)
log.Fatal(http.ListenAndServe(string(cfg.Listen.ClientAPI), nil))
}