mirror of
https://github.com/writefreely/writefreely
synced 2024-09-21 06:01:54 +00:00
Check database connection on startup
This commit is contained in:
parent
3fab9f6439
commit
2178b4abf2
1 changed files with 6 additions and 0 deletions
6
app.go
6
app.go
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue