-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (30 loc) · 863 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"log"
"net"
"os"
"net/http"
)
func init() {
portEnv := os.Getenv("PORT")
if portEnv != "" {
port = portEnv
}
hostPort = net.JoinHostPort("0.0.0.0", port)
meta = map[string]interface{}{
"Version": telerWAFVersion,
"BuildDate": buildDate,
"BuildCommit": buildCommit,
}
}
func main() {
http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("www/assets/"))))
http.HandleFunc("/", indexHandler)
http.HandleFunc("/api/play", playHandler)
log.Printf("teler-waf-playground %s (date: %s)\n", buildCommit, buildDate)
log.Printf("teler-waf version %s\n", telerWAFVersion)
log.Printf("Server started on http://%s\n", hostPort)
if err := http.ListenAndServe(hostPort, nil); err != nil {
log.Fatal(err)
}
}