-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (44 loc) · 1.12 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"flag"
"github.com/sirupsen/logrus"
_ "net/http/pprof"
)
const VERSION = "0.1.0"
func main() {
//go func() {
// http.ListenAndServe("localhost:6060", nil)
//}()
logrus.Infof("duck_server %s", VERSION)
pgListen := flag.String("pg_listen", ":5432", "Postgres listen address")
chListen := flag.String("ch_listen", ":8123", "Clickhouse listen address")
dbPath := flag.String("db_path", "./test.db", "Path to the database file")
logLevel := flag.String("log_level", "info", "Log level")
hack := flag.Bool("hack", true, "hack")
auth := flag.Bool("auth", true, "enable auth")
flag.Parse()
switch *logLevel {
case "trace":
logrus.SetLevel(logrus.TraceLevel)
case "debug":
logrus.SetLevel(logrus.DebugLevel)
case "info":
logrus.SetLevel(logrus.InfoLevel)
case "warn":
logrus.SetLevel(logrus.WarnLevel)
case "error":
logrus.SetLevel(logrus.ErrorLevel)
}
server := PgServer{}
err := server.Start(serverOptions{
DbPath: *dbPath,
Listen: *pgListen,
UseHack: *hack,
ClickhouseOptions: ClickhouseOptions{
Enabled: true,
Listen: *chListen,
},
Auth: *auth,
})
logrus.Fatal(err)
}