Skip to content

Commit

Permalink
fix: make sure auth can access db instance
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Nov 22, 2024
1 parent 1312a1d commit 6f888e2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions sda/cmd/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,18 @@ func main() {

app.Use(sess.Handler())

// Connect to DB
authHandler.Config.DB, err = database.NewSDAdb(config.Database)
if err != nil {
log.Error(err)
panic(err)
}
if authHandler.Config.DB.Version < 14 {
log.Error("database schema v14 is required")
panic(err)
}
defer authHandler.Config.DB.Close()

app.RegisterView(iris.HTML(authHandler.htmlDir, ".html"))
app.HandleDir("/public", iris.Dir(authHandler.staticDir))

Expand All @@ -424,18 +436,6 @@ func main() {
log.Fatalf("Failed to read public key: %s", err.Error())
}

// Connect to DB
config.Auth.DB, err = database.NewSDAdb(config.Database)
if err != nil {
log.Error(err)
panic(err)
}
if config.Auth.DB.Version < 14 {
log.Error("database schema v14 is required")
panic(err)
}
defer config.Auth.DB.Close()

// Endpoint for client login info
app.Get("/info", authHandler.getInfo)

Expand Down

0 comments on commit 6f888e2

Please sign in to comment.