-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (33 loc) · 828 Bytes
/
Copy pathmain.go
File metadata and controls
39 lines (33 loc) · 828 Bytes
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
package main
import (
"os"
"strings"
)
func main() {
if len(os.Args) > 1 {
arg := strings.TrimSpace(strings.ToLower(os.Args[1]))
if arg == "--update" || arg == "update" {
if err := runInteractiveSelfUpdate(); err != nil {
bootFatal("update failed: %v", err)
}
return
}
if arg == "--version" || arg == "-v" || arg == "version" {
printConnectorVersionDetails()
return
}
}
configPath := envOrDefault("CONNECTOR_CONFIG", "./config.json")
cfg, err := loadConfig(configPath)
if err != nil {
bootFatal("failed to load config: %v", err)
return
}
volumesPath := envOrDefault("VOLUMES_PATH", cfg.SFTP.Directory)
printStartupBoot(configPath, cfg, volumesPath)
svc := NewService(cfg, volumesPath)
if err := svc.Start(); err != nil {
bootFatal("connector crashed: %v", err)
return
}
}