Add ACCOUNT_DATABASE env var

This commit is contained in:
Kegan Dougal 2017-05-19 17:22:47 +01:00
parent 2cd9651317
commit a0bcffa68e

View file

@ -19,6 +19,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/matrix-org/dendrite/clientapi/auth/storage"
"github.com/matrix-org/dendrite/clientapi/config" "github.com/matrix-org/dendrite/clientapi/config"
"github.com/matrix-org/dendrite/clientapi/producers" "github.com/matrix-org/dendrite/clientapi/producers"
"github.com/matrix-org/dendrite/clientapi/routing" "github.com/matrix-org/dendrite/clientapi/routing"
@ -37,6 +38,7 @@ var (
clientAPIOutputTopic = os.Getenv("CLIENTAPI_OUTPUT_TOPIC") clientAPIOutputTopic = os.Getenv("CLIENTAPI_OUTPUT_TOPIC")
serverName = gomatrixserverlib.ServerName(os.Getenv("SERVER_NAME")) serverName = gomatrixserverlib.ServerName(os.Getenv("SERVER_NAME"))
serverKey = os.Getenv("SERVER_KEY") serverKey = os.Getenv("SERVER_KEY")
accountDataSource = os.Getenv("ACCOUNT_DATABASE")
) )
func main() { func main() {
@ -79,7 +81,11 @@ func main() {
} }
queryAPI := api.NewRoomserverQueryAPIHTTP(cfg.RoomserverURL, nil) queryAPI := api.NewRoomserverQueryAPIHTTP(cfg.RoomserverURL, nil)
accountDB, err := storage.NewAccountDatabase("", serverName)
if err != nil {
log.Panicf("Failed to setup account database(%s): %s", accountDataSource, err.Error())
}
routing.Setup(http.DefaultServeMux, http.DefaultClient, cfg, roomserverProducer, queryAPI, nil) routing.Setup(http.DefaultServeMux, http.DefaultClient, cfg, roomserverProducer, queryAPI, accountDB)
log.Fatal(http.ListenAndServe(bindAddr, nil)) log.Fatal(http.ListenAndServe(bindAddr, nil))
} }