diff --git a/cmd/dendrite-demo-yggdrasil/embed/embed_other.go b/cmd/dendrite-demo-yggdrasil/embed/embed_other.go index a9108fad3..598881148 100644 --- a/cmd/dendrite-demo-yggdrasil/embed/embed_other.go +++ b/cmd/dendrite-demo-yggdrasil/embed/embed_other.go @@ -2,6 +2,8 @@ package embed -func Embed(_ int, _ string) { +import "github.com/gorilla/mux" + +func Embed(_ *mux.Router, _ int, _ string) { } diff --git a/cmd/dendrite-demo-yggdrasil/embed/embed_riotweb.go b/cmd/dendrite-demo-yggdrasil/embed/embed_riotweb.go index 360d0bc5b..a9e04a312 100644 --- a/cmd/dendrite-demo-yggdrasil/embed/embed_riotweb.go +++ b/cmd/dendrite-demo-yggdrasil/embed/embed_riotweb.go @@ -7,19 +7,20 @@ import ( "io" "net/http" + "github.com/gorilla/mux" "github.com/tidwall/sjson" ) // From within the Riot Web directory: // go run github.com/mjibson/esc -o /path/to/dendrite/internal/embed/fs_riotweb.go -private -pkg embed . -func Embed(listenPort int, serverName string) { +func Embed(rootMux *mux.Router, listenPort int, serverName string) { url := fmt.Sprintf("http://localhost:%d", listenPort) embeddedFS := _escFS(false) embeddedServ := http.FileServer(embeddedFS) - http.DefaultServeMux.Handle("/", embeddedServ) - http.DefaultServeMux.HandleFunc("/config.json", func(w http.ResponseWriter, _ *http.Request) { + rootMux.Handle("/", embeddedServ) + rootMux.HandleFunc("/config.json", func(w http.ResponseWriter, _ *http.Request) { configFile, err := embeddedFS.Open("/config.sample.json") if err != nil { w.WriteHeader(500) diff --git a/cmd/dendrite-demo-yggdrasil/main.go b/cmd/dendrite-demo-yggdrasil/main.go index be15da472..328aa0629 100644 --- a/cmd/dendrite-demo-yggdrasil/main.go +++ b/cmd/dendrite-demo-yggdrasil/main.go @@ -154,7 +154,7 @@ func main() { logrus.WithError(err).Panicf("failed to connect to public rooms db") } - embed.Embed(*instancePort, "Yggdrasil Demo") + embed.Embed(base.BaseMux, *instancePort, "Yggdrasil Demo") monolith := setup.Monolith{ Config: base.Cfg,