Check database connection on startup

This commit is contained in:
ekzyis 2023-09-09 22:52:50 +02:00
parent dabb1be2f0
commit 2053d15290
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,10 @@ func init() {
flag.Parse()
validateFlags()
db = initDb()
_, err = db.Exec("SELECT 1")
if err != nil {
log.Fatal(err)
}
}
func initDb() *sql.DB {