Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("ok\n"))
|
||||
})
|
||||
mux.HandleFunc("GET /ws/v1/signaling", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Deliberately disabled until authentication, authorization, message limits,
|
||||
// replay protection and routing are implemented.
|
||||
http.Error(w, "signaling is not enabled in scaffold", http.StatusNotImplemented)
|
||||
})
|
||||
addr := os.Getenv("SIGNALING_ADDR")
|
||||
if addr == "" {
|
||||
addr = ":8081"
|
||||
}
|
||||
srv := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
log.Printf("signaling service listening on %s", addr)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
Reference in New Issue
Block a user