-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (36 loc) · 791 Bytes
/
main.go
File metadata and controls
47 lines (36 loc) · 791 Bytes
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 (
"log"
"net/http"
"os"
"time"
"github.com/getsentry/sentry-go"
"github.com/hatchdotlol/hatch-api/pkg/api"
"github.com/hatchdotlol/hatch-api/pkg/db"
"github.com/hatchdotlol/hatch-api/pkg/util"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
util.InitConfig()
if err := sentry.Init(sentry.ClientOptions{
Dsn: os.Getenv("SENTRY_DSN"),
}); err != nil {
log.Fatal(err)
}
if err := db.InitDB(); err != nil {
sentry.CaptureException(err)
log.Fatal(err)
}
go func() {
if err := db.InitS3(); err != nil {
sentry.CaptureException(err)
log.Fatal(err)
}
}()
r := api.Router()
sentry.CaptureMessage("Starting API")
log.Printf("Starting server at :8080\n")
http.ListenAndServe(":8080", r)
sentry.Flush(time.Second * 5)
}