-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
47 lines (39 loc) · 906 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
47
package main
import (
"errors"
"flag"
"log"
"os"
"github.com/NHAS/confy"
"github.com/NHAS/gohunt/application"
"github.com/NHAS/gohunt/config"
)
func main() {
c, warnings, err := confy.Config[config.Config](
confy.Defaults("config", "config.yaml"),
confy.WithStrictParsing(),
)
if err != nil {
if !errors.Is(err, flag.ErrHelp) {
log.Fatal(err)
}
return
}
for _, warning := range warnings {
log.Println("recieved warning from while parsing configuration sources: ", warning)
}
if len(c.Notification.Webhooks.SafeDomains) == 0 {
c.Notification.Webhooks.SafeDomains = []string{"discord.com", "slack.com"}
}
app, err := application.New(c)
if err != nil {
log.Println("failed to make new application from config: ", err)
os.Exit(1)
return
}
if err := app.Run(); err != nil {
log.Printf("application failed and had to stop: %s", err)
os.Exit(1)
return
}
}