-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
42 lines (33 loc) · 855 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
package main
import (
"flag"
"log"
"os"
"os/signal"
"path/filepath"
"syscall"
"github.com/arriqaaq/kubediff/config"
"github.com/arriqaaq/kubediff/pkg/watcher"
)
var (
configFilePath = "config.yaml"
configPath = flag.String("config", "", "config folder path")
)
func main() {
flag.Parse()
filepath := filepath.Join(*configPath, configFilePath)
conf, err := config.New(filepath)
if err != nil {
log.Fatalf("Error in loading configuration. Error:%s", err.Error())
}
watcher, err := watcher.NewWatcher(conf)
if err != nil {
log.Fatalf("Error in loading configuration. Error:%s", err.Error())
}
stopCh := make(chan struct{})
defer close(stopCh)
watcher.Run(stopCh)
sigterm := make(chan os.Signal, 1)
signal.Notify(sigterm, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGSTOP)
<-sigterm
}