9 "git.curoverse.com/arvados.git/sdk/go/config"
10 "github.com/Sirupsen/logrus"
16 configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
17 dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
18 cfg := DefaultConfig()
21 err := config.LoadFile(&cfg, *configPath)
26 lvl, err := logrus.ParseLevel(cfg.LogLevel)
30 rootLogger.Level = lvl
31 switch cfg.LogFormat {
33 rootLogger.Formatter = &logrus.TextFormatter{
35 TimestampFormat: time.RFC3339Nano,
38 rootLogger.Formatter = &logrus.JSONFormatter{
39 TimestampFormat: time.RFC3339Nano,
42 log.WithField("LogFormat", cfg.LogFormat).Fatal("unknown log format")
46 txt, err := config.Dump(&cfg)
50 fmt.Print(string(txt))
54 eventSource := &pgEventSource{
55 DataSource: cfg.Postgres.ConnectionString(),
56 QueueSize: cfg.ServerEventQueue,
60 ReadTimeout: time.Minute,
61 WriteTimeout: time.Minute,
62 MaxHeaderBytes: 1 << 20,
65 eventSource: eventSource,
68 eventSource.NewSink().Stop()
70 log.WithField("Listen", srv.Addr).Info("listening")
71 log.Fatal(srv.ListenAndServe())