-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (38 loc) · 993 Bytes
/
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
package main
import (
"flag"
"os"
"github.com/flaviostutz/elasticblast/elasticblast"
"github.com/sirupsen/logrus"
)
func main() {
blastURL := flag.String("blast-url", "", "Blast URL to which REST calls will be sent after converted from ES request. Example: http://blast:6000")
logLevel := flag.String("log-level", "info", "debug, info, warning or error")
flag.Parse()
switch *logLevel {
case "debug":
logrus.SetLevel(logrus.DebugLevel)
break
case "warning":
logrus.SetLevel(logrus.WarnLevel)
break
case "error":
logrus.SetLevel(logrus.ErrorLevel)
break
default:
logrus.SetLevel(logrus.InfoLevel)
}
logrus.Debug("Preparing options")
blastURL0 := *blastURL
if blastURL0 == "" {
logrus.Error("--blast-url is required")
os.Exit(1)
}
logrus.Infof("====Starting Elasticsearch to Blast bridge====")
h := elasticblast.NewHTTPServer(blastURL0)
err := h.Start()
if err != nil {
logrus.Errorf("Failed to initialize bridge. err=%s", err)
os.Exit(1)
}
}