1
Fork 0

Move ice-servers.json under dataDir.

This makes it easier to deploy by putting all user-serviceable files
under data/.
This commit is contained in:
Juliusz Chroboczek 2020-08-07 11:14:34 +02:00
parent 4e594465cc
commit 8a4d315c51
4 changed files with 10 additions and 3 deletions

2
README
View File

@ -15,7 +15,7 @@ Set the server administrator's username and password (optional):
Configure the list of STUN and TURN servers (optional): Configure the list of STUN and TURN servers (optional):
vi static/ice-servers.json vi data/ice-servers.json
Set up a group Set up a group

2
sfu.go
View File

@ -81,7 +81,7 @@ func main() {
}() }()
} }
iceFilename = filepath.Join(staticRoot, "ice-servers.json") iceFilename = filepath.Join(dataDir, "ice-servers.json")
go readPublicGroups() go readPublicGroups()
webserver() webserver()

View File

@ -24,7 +24,8 @@ func webserver() {
http.HandleFunc("/group/", http.HandleFunc("/group/",
func(w http.ResponseWriter, r *http.Request) { func(w http.ResponseWriter, r *http.Request) {
mungeHeader(w) mungeHeader(w)
http.ServeFile(w, r, staticRoot+"/sfu.html") http.ServeFile(w, r,
filepath.Join(staticRoot, "sfu.html"))
}) })
http.HandleFunc("/recordings", http.HandleFunc("/recordings",
func(w http.ResponseWriter, r *http.Request) { func(w http.ResponseWriter, r *http.Request) {
@ -33,6 +34,12 @@ func webserver() {
}) })
http.HandleFunc("/recordings/", recordingsHandler) http.HandleFunc("/recordings/", recordingsHandler)
http.HandleFunc("/ws", wsHandler) http.HandleFunc("/ws", wsHandler)
http.HandleFunc("/ice-servers.json",
func(w http.ResponseWriter, r *http.Request) {
mungeHeader(w)
http.ServeFile(w, r,
filepath.Join(dataDir, "ice-servers.json"))
})
http.HandleFunc("/public-groups.json", publicHandler) http.HandleFunc("/public-groups.json", publicHandler)
http.HandleFunc("/stats", statsHandler) http.HandleFunc("/stats", statsHandler)