@@ -21,13 +21,20 @@ var publishAddress = flag.String("publishAddress", "", "The address (ip+port) to
21
21
var timeAcquisitionMode = flag .String ("timeAcquisitionMode" , "" , "The time acquisitionMode to use (system, ci, vision)" )
22
22
var skipInterfaces = flag .String ("skipInterfaces" , "" , "Comma separated list of interface names to ignore when receiving multicast packets" )
23
23
var verbose = flag .Bool ("verbose" , false , "Verbose output" )
24
+ var backendOnly = flag .Bool ("backendOnly" , false , "Do not serve the UI and API" )
24
25
25
26
const configFileName = "config/ssl-game-controller.yaml"
26
27
27
28
func main () {
28
29
flag .Parse ()
29
30
30
31
setupGameController ()
32
+
33
+ if backendOnly != nil && * backendOnly {
34
+ blockForever ()
35
+ return
36
+ }
37
+
31
38
setupUi ()
32
39
33
40
err := http .ListenAndServe (* address , nil )
@@ -36,6 +43,10 @@ func main() {
36
43
}
37
44
}
38
45
46
+ func blockForever () {
47
+ select {}
48
+ }
49
+
39
50
func setupGameController () {
40
51
cfg := config .LoadConfig (configFileName )
41
52
@@ -70,8 +81,10 @@ func setupGameController() {
70
81
os .Exit (0 )
71
82
}()
72
83
73
- // serve the bidirectional web socket
74
- http .HandleFunc ("/api/control" , gameController .ApiServer ().WsHandler )
84
+ if backendOnly == nil || ! * backendOnly {
85
+ // serve the bidirectional web socket
86
+ http .HandleFunc ("/api/control" , gameController .ApiServer ().WsHandler )
87
+ }
75
88
}
76
89
77
90
func setupUi () {
0 commit comments