8460: Receive events and broadcast to clients.
[arvados.git] / services / ws / main.go
index 9a24b312b05344c07a4331b7652199a379f82869..0f978231b9658068bd8351a582c4328d3383e1e0 100644 (file)
@@ -10,6 +10,8 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/config"
 )
 
+var debugLogf = func(string, ...interface{}) {}
+
 func main() {
        configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
        dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
@@ -20,6 +22,9 @@ func main() {
        if err != nil {
                log.Fatal(err)
        }
+       if cfg.Debug {
+               debugLogf = log.Printf
+       }
 
        if *dumpConfig {
                txt, err := config.Dump(&cfg)
@@ -36,10 +41,11 @@ func main() {
                WriteTimeout:   time.Minute,
                MaxHeaderBytes: 1 << 20,
                Handler: &router{
-                       EventSource: (&pgEventSource{
+                       Config: &cfg,
+                       eventSource: &pgEventSource{
                                PgConfig:  cfg.Postgres,
                                QueueSize: cfg.ServerEventQueue,
-                       }).EventSource(),
+                       },
                },
        }
        log.Fatal(srv.ListenAndServe())