Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sumi-k committed Sep 18, 2023
1 parent 2330d80 commit 1bd6ce7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
//go:embed templates/*.html
var templateFS embed.FS

var r *gin.Engine
var router *gin.Engine
var ginLambda *ginadapter.GinLambda

func inLambda() bool {
Expand All @@ -55,7 +55,6 @@ func setupRouter() *gin.Engine {
router.Use(gzip.Gzip(gzip.DefaultCompression))

utilsRepo := utils.NewEmail()

contactRepo := contact.New(templateFS, utilsRepo)
jobsRepo := jobs.New(sqlDb, templateFS, utilsRepo)
sitemapRepo := sitemap.New(jobsRepo)
Expand Down Expand Up @@ -100,15 +99,16 @@ func corsConfig() cors.Config {
}

func main() {
r = setupRouter()
ginLambda = ginadapter.New(r)
router = setupRouter()
log.Info("router: ", router)
ginLambda = ginadapter.New(router)
inLambda := inLambda()
log.Info("inLambda: ", inLambda)
if inLambda {
log.Info("running aws lambda in aws")
lambda.Start(LambdaHandler)
} else {
log.Info("running aws lambda in local")
log.Fatal(http.ListenAndServe(":8082", r))
log.Fatal(http.ListenAndServe(":8082", router))
}
}

0 comments on commit 1bd6ce7

Please sign in to comment.