-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
54 lines (44 loc) · 1.15 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
48
49
50
51
52
53
54
package main
import (
"flag"
"os"
"github.com/flaviostutz/backtor/backtor"
"github.com/sirupsen/logrus"
)
var options backtor.Options
func main() {
conductorAPIURL := flag.String("conductor-api-url", "", "Base Conductor API URL for calling backup workflows")
logLevel := flag.String("log-level", "info", "debug, info, warning or error")
dataDir := flag.String("data-dir", "/var/lib/backtor/data", "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")
options.ConductorAPIURL = *conductorAPIURL
options.DataDir = *dataDir
if options.ConductorAPIURL == "" {
logrus.Error("--conductor-api-url is required")
os.Exit(1)
}
if options.DataDir == "" {
logrus.Error("--data-dir cannot be empty")
os.Exit(1)
}
logrus.Infof("====Starting backtor====")
err := backtor.InitAll(options)
if err != nil {
logrus.Errorf("Failed to initialize backtor. err=%s", err)
os.Exit(1)
}
}