-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.go
40 lines (32 loc) · 841 Bytes
/
app.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
package main
import (
"math/rand"
"os"
"os/signal"
"syscall"
"time"
kjs "github.com/replicatedhq/kots-lint/kubernetes_json_schema"
"github.com/replicatedhq/kots-lint/pkg/daemon"
"github.com/replicatedhq/kots-lint/pkg/kots"
log "github.com/sirupsen/logrus"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
if logLevel, err := log.ParseLevel(os.Getenv("LOG_LEVEL")); err == nil {
log.SetLevel(logLevel)
}
schemaDir, err := kjs.InitKubernetesJsonSchemaDir()
if err != nil {
log.Errorf("failed to init kubernetes json schema dir: %v", err)
os.Exit(1)
}
defer os.RemoveAll(schemaDir)
if err := kots.InitOPALinting(); err != nil {
log.Errorf("failed to init opa linting: %v", err)
os.Exit(1)
}
go daemon.Run()
term := make(chan os.Signal)
signal.Notify(term, syscall.SIGINT, syscall.SIGTERM)
<-term
}