-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
44 lines (41 loc) · 972 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 (
"github.com/techartificer/swiftex/config"
"github.com/techartificer/swiftex/database"
"github.com/techartificer/swiftex/lib/firebase"
"github.com/techartificer/swiftex/lib/random"
"github.com/techartificer/swiftex/logger"
"github.com/techartificer/swiftex/models"
"github.com/techartificer/swiftex/server"
"github.com/techartificer/swiftex/validators"
)
func init() {
logger.SetupLog()
random.Initialize()
validators.InitValidator()
if err := config.LoadConfig(); err != nil {
panic(err)
}
if err := database.ConnectMongo(); err != nil {
panic(err)
}
if err := database.ConnectRedis(); err != nil {
panic(err)
}
if err := models.InitializeIndex(database.GetDB()); err != nil {
panic(err)
}
if err := firebase.Initialize(); err != nil {
panic(err)
}
}
func main() {
defer func() {
err := database.DisconnectMongo()
if err != nil {
logger.Log.Errorln(err)
}
}()
server.Start()
//! Don't write code here
}