@@ -21,13 +21,20 @@ var publishAddress = flag.String("publishAddress", "", "The address (ip+port) to
2121var timeAcquisitionMode = flag .String ("timeAcquisitionMode" , "" , "The time acquisitionMode to use (system, ci, vision)" )
2222var skipInterfaces = flag .String ("skipInterfaces" , "" , "Comma separated list of interface names to ignore when receiving multicast packets" )
2323var verbose = flag .Bool ("verbose" , false , "Verbose output" )
24+ var backendOnly = flag .Bool ("backendOnly" , false , "Do not serve the UI and API" )
2425
2526const configFileName = "config/ssl-game-controller.yaml"
2627
2728func main () {
2829 flag .Parse ()
2930
3031 setupGameController ()
32+
33+ if backendOnly != nil && * backendOnly {
34+ blockForever ()
35+ return
36+ }
37+
3138 setupUi ()
3239
3340 err := http .ListenAndServe (* address , nil )
@@ -36,6 +43,10 @@ func main() {
3643 }
3744}
3845
46+ func blockForever () {
47+ select {}
48+ }
49+
3950func setupGameController () {
4051 cfg := config .LoadConfig (configFileName )
4152
@@ -70,8 +81,10 @@ func setupGameController() {
7081 os .Exit (0 )
7182 }()
7283
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+ }
7588}
7689
7790func setupUi () {
0 commit comments