-
Notifications
You must be signed in to change notification settings - Fork 49
/
main.go
38 lines (30 loc) · 897 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
package main
import (
"math/rand"
"time"
"github.com/OdyseeTeam/odysee-api/apps/lbrytv/config"
"github.com/OdyseeTeam/odysee-api/cmd"
"github.com/OdyseeTeam/odysee-api/internal/monitor"
"github.com/OdyseeTeam/odysee-api/internal/storage"
"github.com/OdyseeTeam/odysee-api/pkg/migrator"
"github.com/OdyseeTeam/odysee-api/version"
"github.com/getsentry/sentry-go"
)
func main() {
rand.Seed(time.Now().UnixNano())
// defer func() {
// sentry.Flush(3 * time.Second)
// sentry.Recover()
// }()
monitor.IsProduction = config.IsProduction()
monitor.ConfigureSentry(config.GetSentryDSN(), version.GetDevVersion(), monitor.LogMode())
defer sentry.Flush(2 * time.Second)
db, err := migrator.ConnectDB(migrator.DBConfigFromApp(config.GetDatabase()))
if err != nil {
panic(err)
}
defer db.Close()
storage.SetDB(db)
go storage.WatchMetrics(10 * time.Second)
cmd.Execute()
}