Skip to content

Commit

Permalink
wax. move db init inside main method
Browse files Browse the repository at this point in the history
Avoid error:

   (sql: database is closed)
  • Loading branch information
gsanchietti committed Apr 18, 2018
1 parent 2e6527e commit db1c213
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wax/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ func DefineAPI(router *gin.Engine) {
corsConf.AllowMethods = configuration.Config.Cors.Methods
router.Use(cors.New(corsConf))

// init Database
db := database.Init()
defer db.Close()

health := router.Group("/health")
health.GET("/check", methods.HealthCheck)

Expand Down Expand Up @@ -94,6 +90,10 @@ func main() {
flag.Parse()
configuration.Init(ConfigFilePtr)

// init Database
db := database.Init()
defer db.Close()

// init routers
router := gin.Default()

Expand Down

0 comments on commit db1c213

Please sign in to comment.