Check database connection on startup

This commit is contained in:
Matt Baer 2018-12-13 19:15:09 -05:00
parent 3fab9f6439
commit 2178b4abf2

6
app.go
View file

@ -413,6 +413,12 @@ func Serve() {
connectToDatabase(app)
defer shutdown(app)
// Test database connection
err = db.Ping()
if err != nil {
log.Error("Database ping failed: %s", err)
}
r := mux.NewRouter()
handler := NewHandler(app)
handler.SetErrorPages(&ErrorPages{