fix(backend): make sure database connection was successful before continuing

This commit is contained in:
2025-03-11 17:50:25 +01:00
parent 1597fb9b31
commit 9088916f92
2 changed files with 19 additions and 6 deletions

View File

@ -22,7 +22,11 @@ func main() {
slog.Error("MONGO_URI environment variable not set!")
return
}
db.InitDB(mongoUri)
ok := db.InitDB(mongoUri)
if !ok {
slog.Error("Initializing MongoDB database failed")
return
}
game.LoadRooms()
roomTicker := time.NewTicker(1 * time.Second)