-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (33 loc) · 787 Bytes
/
main.go
File metadata and controls
43 lines (33 loc) · 787 Bytes
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
37
38
39
40
41
42
43
package main
import (
"fmt"
_ "net/http"
"os"
_ "strings"
_ "time"
log "github.com/Sirupsen/logrus"
. "github.com/darkua/babl-dashboard/httpserver"
)
const Version = "0.0.1"
const clientID = "babl-dashboard"
var debug bool
func main() {
log.SetOutput(os.Stderr)
log.SetFormatter(&log.JSONFormatter{})
log.SetLevel(log.WarnLevel)
log.Warn("App START")
run(":8000", false)
}
func run(listen string, dbg bool) {
debug = dbg
if debug {
log.SetLevel(log.DebugLevel)
}
// websockets
log.Warn("App Run Websockets Hub")
wsHub := NewHub()
go wsHub.Run()
// StartHttpServer(listen, wsHub, HandlerRequestHistory, HandlerRequestDetails, HandlerRequestPayload)
log.Warn(fmt.Sprintf("App Start WebServer running on port %s", listen))
StartHttpServer(listen, wsHub)
}