forked from Glimesh/broadcast-box
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (35 loc) · 1.11 KB
/
main.go
File metadata and controls
44 lines (35 loc) · 1.11 KB
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
44
package main
import (
"log"
"os"
"runtime"
"strings"
"time"
"github.com/glimesh/broadcast-box/internal/chat"
"github.com/glimesh/broadcast-box/internal/console"
"github.com/glimesh/broadcast-box/internal/environment"
"github.com/glimesh/broadcast-box/internal/networktest"
"github.com/glimesh/broadcast-box/internal/server"
"github.com/glimesh/broadcast-box/internal/webrtc"
"net/http"
_ "net/http/pprof"
)
func main() {
environment.SetupLogger()
environment.LoadEnvironmentVariables()
console.HandleConsoleFlags()
if shouldProfileApplication := os.Getenv(environment.EnableProfiling); strings.EqualFold(shouldProfileApplication, "true") {
go func() {
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
}
log.Println("Booting up Broadcast", time.Now().Format("2006-01-02 15:04:05"))
chatManager := chat.NewManager()
webrtc.Setup(chatManager)
if shouldNetworkTest := os.Getenv(environment.NetworkTestOnStart); strings.EqualFold(shouldNetworkTest, "true") {
networktest.RunNetworkTest()
}
server.StartWebServer()
}