forked from Notifiarr/notifiarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (37 loc) · 1.12 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
//nolint:godot
package main
import (
"log"
"runtime/debug"
"github.com/Notifiarr/notifiarr/pkg/client"
"github.com/Notifiarr/notifiarr/pkg/mnd"
"github.com/Notifiarr/notifiarr/pkg/ui"
)
// @title Notifiarr Client API Docs
// @version 1.0
// @description Notifiarr Client monitors local services and sends notifications.
// @termsOfService https://notifiarr.com
// @contact.name Notifiarr Discord
// @contact.url https://notifiarr.com/discord
// @license.name MIT
// @license.url https://github.com/Notifiarr/notifiarr/blob/main/LICENSE
// @BasePath /
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name X-API-Key
func main() {
ui.HideConsoleWindow()
// setup log package in case we throw an error in main.go before logging is setup.
log.SetFlags(log.LstdFlags)
log.SetPrefix("[ERROR] ")
defer func() {
if r := recover(); r != nil {
ui.ShowConsoleWindow()
log.Printf("Go Panic! %s\n%v\n%s", mnd.BugIssue, r, string(debug.Stack()))
}
}()
if err := client.Start(); err != nil {
_, _ = ui.Error(mnd.Title, err.Error())
log.Fatal(err) //nolint:gocritic // defer does not need to run if we have an error.
}
}