fix SQLite

This commit is contained in:
stefan 2025-06-05 14:38:32 +02:00
parent 935070e211
commit 0482ef8479
3 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,8 @@ services:
- "8080:8081"
volumes:
- sqlite_data:/app/data # Volume für SQLite Datenbank
environment:
- USE_SQLITE=true
networks:
- meldestelle-net

View File

@ -37,12 +37,15 @@ fun configureDatabase() {
throw e // Rethrow error, test should fail
}
} else {
// Check if we're running in IDEA (no Docker environment variables set)
// We only check one variable, that's usually enough
// Check if we should use SQLite (either in IDEA or in Docker with SQLite)
// First check for explicit SQLite flag
val useSqlite = System.getenv("USE_SQLITE")?.toBoolean() ?: false
// Then check if we're in IDEA (no Docker environment variables set)
val dbHostFromEnv = System.getenv("DB_HOST")
val isIdeaEnvironment = (dbHostFromEnv == null)
if (isIdeaEnvironment) {
if (useSqlite || isIdeaEnvironment) {
// Ensure the data directory exists
val dataDir = File("data")
if (!dataDir.exists()) {

View File

@ -1,6 +1,7 @@
package at.mocode.routes
import at.mocode.model.Bewerb
import at.mocode.config.DependencyInjection
import at.mocode.repository.TurnierRepository
import at.mocode.views.AdminView
import io.ktor.http.*
@ -15,7 +16,7 @@ import org.slf4j.LoggerFactory
*/
fun Route.adminRoutes() {
val log = LoggerFactory.getLogger("AdminRoutes")
val turnierRepository = TurnierRepository()
val turnierRepository = DependencyInjection.turnierRepository
val adminView = AdminView()
// Route to display the tournament management page