mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:59:03 +00:00
make SetupDatabase returns an error and use PingContext with timeout
This commit is contained in:
@@ -30,7 +30,10 @@ func main() {
|
||||
|
||||
devMode := os.Getenv("DEVELOPMENT") == "1"
|
||||
|
||||
db := database.SetupDatabase()
|
||||
db, err := database.SetupDatabase()
|
||||
if err != nil {
|
||||
log.Panicf("Could not connect to database: %s\n", err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
// Migrate database
|
||||
@@ -96,5 +99,5 @@ func main() {
|
||||
|
||||
}
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+apiListenUrl.Port(), rootRouter))
|
||||
log.Panic(http.ListenAndServe(":"+apiListenUrl.Port(), rootRouter))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user