-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
44 lines (35 loc) · 835 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
package main
import (
"context"
"time"
"github.com/FlagBrew/CoreAPI/internal/models"
"github.com/apex/log"
"github.com/getsentry/sentry-go"
"github.com/lrstanley/chix"
"github.com/lrstanley/clix"
)
var (
cli = &clix.CLI[models.Flags]{
Links: clix.GithubLinks("github.com/FlagBrew/CoreAPI", "master", "https://coreapi.flagbrew.org"),
}
logger log.Interface
)
func main() {
// Setup the Cli and Logger
cli.Parse()
logger = cli.Logger
// Ensure configured is set to true
if !cli.Flags.Configured {
logger.Fatal("Not configured yet, please configure")
}
sentry.Init(sentry.ClientOptions{
Dsn: cli.Flags.Logging.SentryDSN,
})
ctx := context.Background()
if err := chix.RunCtx(
ctx, httpServer(ctx),
); err != nil {
defer sentry.Flush(2 * time.Second)
log.WithError(err).Fatal("shutting down")
}
}