generated from GDGVIT/template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
38 lines (28 loc) · 929 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 (
"time"
"github.com/GDGVIT/attendance-app-backend/config"
"github.com/GDGVIT/attendance-app-backend/infra/database"
"github.com/GDGVIT/attendance-app-backend/infra/logger"
"github.com/GDGVIT/attendance-app-backend/migrations"
"github.com/GDGVIT/attendance-app-backend/routers"
"github.com/spf13/viper"
)
func main() {
//set timezone
viper.SetDefault("SERVER_TIMEZONE", "Asia/Calcutta")
loc, _ := time.LoadLocation(viper.GetString("SERVER_TIMEZONE"))
time.Local = loc
if err := config.SetupConfig(); err != nil {
logger.Fatalf("config SetupConfig() error: %s", err)
}
config.InitialiseOAuthGoogle()
DSN := config.DbConfiguration()
if err := database.DbConnection(DSN); err != nil {
logger.Fatalf("database DbConnection error: %s", err)
}
//later separate migration
migrations.Migrate()
router := routers.SetupRoute()
logger.Fatalf("%v", router.Run(config.ServerConfig()))
}