1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-29 07:30:54 +02:00

Implement config loading

This commit is contained in:
Alexandre Iooss
2020-09-21 19:59:41 +02:00
parent a0d814b76b
commit 28e3b4c753
5 changed files with 382 additions and 7 deletions

View File

@ -5,6 +5,8 @@ import (
"log"
"net/http"
"os"
"gitlab.crans.org/nounous/ghostream/internal/config"
)
// Preload templates
@ -42,14 +44,12 @@ func handleStatic(w http.ResponseWriter, r *http.Request) {
}
}
func ServeHTTP() {
// Load settings
listen_address := "127.0.0.1:8080"
// ServeHTTP server
func ServeHTTP(cfg *config.Config) {
// Set up HTTP router and server
http.HandleFunc("/", handlerViewer)
http.HandleFunc("/rtmp/auth", handleStreamAuth)
http.HandleFunc("/static/", handleStatic)
log.Print("Listening on http://" + listen_address)
log.Fatal(http.ListenAndServe(listen_address, nil))
log.Printf("Listening on http://%s/", cfg.Site.ListenAdress)
log.Fatal(http.ListenAndServe(cfg.Site.ListenAdress, nil))
}