forked from kuskoman/logstash-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
34 lines (28 loc) · 739 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
package main
import (
"context"
"log/slog"
"os"
"github.com/kuskoman/logstash-exporter/internal/flags"
"github.com/kuskoman/logstash-exporter/internal/startup_manager"
)
func main() {
flagsConfig, err := flags.ParseFlags(os.Args[1:])
if err != nil {
slog.Error("failed to parse flags", "err", err)
return
}
if shouldExit := flags.HandleFlags(flagsConfig); shouldExit {
os.Exit(0)
}
startupManager, err := startup_manager.NewStartupManager(flagsConfig.ConfigLocation, flagsConfig)
if err != nil {
slog.Error("failed to create startup manager", "err", err)
os.Exit(1)
}
ctx := context.TODO()
if err := startupManager.Initialize(ctx); err != nil {
slog.Error("critical error", "error", err)
os.Exit(1)
}
}