9 "git.curoverse.com/arvados.git/sdk/go/config"
10 log "github.com/Sirupsen/logrus"
14 configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
15 dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
16 cfg := DefaultConfig()
19 err := config.LoadFile(&cfg, *configPath)
24 lvl, err := log.ParseLevel(cfg.LogLevel)
29 switch cfg.LogFormat {
31 log.SetFormatter(&log.TextFormatter{
33 TimestampFormat: time.RFC3339Nano,
36 log.SetFormatter(&log.JSONFormatter{
37 TimestampFormat: time.RFC3339Nano,
40 log.WithField("LogFormat", cfg.LogFormat).Fatal("unknown log format")
44 txt, err := config.Dump(&cfg)
48 fmt.Print(string(txt))
52 eventSource := &pgEventSource{
53 DataSource: cfg.Postgres.ConnectionString(),
54 QueueSize: cfg.ServerEventQueue,
58 ReadTimeout: time.Minute,
59 WriteTimeout: time.Minute,
60 MaxHeaderBytes: 1 << 20,
63 eventSource: eventSource,
66 eventSource.NewSink().Stop()
68 log.WithField("Listen", srv.Addr).Info("listening")
69 log.Fatal(srv.ListenAndServe())