-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (36 loc) · 1.06 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
43
44
package main
import (
"github.com/gofiber/swagger"
"github.com/pakut2/mandarin/cmd/notification_api"
"github.com/pakut2/mandarin/cmd/notification_scanner"
"github.com/pakut2/mandarin/cmd/schedule_provider_api"
"github.com/pakut2/mandarin/config"
_ "github.com/pakut2/mandarin/docs"
"github.com/pakut2/mandarin/pkg/database"
firebase_admin "github.com/pakut2/mandarin/pkg/firebase"
"github.com/pakut2/mandarin/pkg/logger"
"github.com/pakut2/mandarin/pkg/server"
)
func main() {
if err := config.LoadEnvVariables(); err != nil {
panic(err)
}
if err := database.InitConnection(); err != nil {
panic(err)
}
defer database.CloseConnection()
if err := logger.InitLogger(); err != nil {
panic(err)
}
defer logger.Logger.Sync()
server := server.InitServer()
notification_api.InitApi(server)
schedule_provider_api.InitApi(server)
firebaseAdmin, err := firebase_admin.InitFirebaseAdmin()
if err != nil {
panic(err)
}
notification_scanner.InitScanner(firebaseAdmin)
server.Get("/api/*", swagger.HandlerDefault)
server.Listen("0.0.0.0:" + config.Env.PORT)
}