Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
waveyboym authored Jul 20, 2024
1 parent 1e9afb2 commit 7246c97
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions occupi-backend/cmd/occupi-backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func main() {
// attach session middleware
attachSessionMiddleware(ginRouter)

// attach timezone middleware
attachTimeZoneMiddelware(ginRouter)

// attach real ip middleware
attachRealIPMiddleware(ginRouter)

// Register routes
router.OccupiRouter(ginRouter, appsession)

Expand Down Expand Up @@ -141,6 +147,16 @@ func attachSessionMiddleware(ginRouter *gin.Engine) {
ginRouter.Use(sessions.Sessions("occupi-sessions-store", store))
}

func attachTimeZoneMiddelware(ginRouter *gin.Engine) {
// TimezoneMiddleware is a middleware that sets the timezone for the request.
ginRouter.Use(middleware.TimezoneMiddleware())
}

func attachRealIPMiddleware(ginRouter *gin.Engine) {
// RealIPMiddleware is a middleware that sets the real IP for the request.
ginRouter.Use(middleware.RealIPMiddleware())
}

func runServer(ginRouter *gin.Engine) {
certFile := configs.GetCertFileName()
keyFile := configs.GetKeyFileName()
Expand Down

0 comments on commit 7246c97

Please sign in to comment.