mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-29 09:41:57 -06:00
Fix embed Riot Web into Yggdrasil demo
This commit is contained in:
parent
ddf1c8adf1
commit
3547a1768c
|
@ -2,6 +2,8 @@
|
|||
|
||||
package embed
|
||||
|
||||
func Embed(_ int, _ string) {
|
||||
import "github.com/gorilla/mux"
|
||||
|
||||
func Embed(_ *mux.Router, _ int, _ string) {
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue