fix SQLite
This commit is contained in:
parent
935070e211
commit
0482ef8479
|
|
@ -9,6 +9,8 @@ services:
|
||||||
- "8080:8081"
|
- "8080:8081"
|
||||||
volumes:
|
volumes:
|
||||||
- sqlite_data:/app/data # Volume für SQLite Datenbank
|
- sqlite_data:/app/data # Volume für SQLite Datenbank
|
||||||
|
environment:
|
||||||
|
- USE_SQLITE=true
|
||||||
networks:
|
networks:
|
||||||
- meldestelle-net
|
- meldestelle-net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,15 @@ fun configureDatabase() {
|
||||||
throw e // Rethrow error, test should fail
|
throw e // Rethrow error, test should fail
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if we're running in IDEA (no Docker environment variables set)
|
// Check if we should use SQLite (either in IDEA or in Docker with SQLite)
|
||||||
// We only check one variable, that's usually enough
|
// 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 dbHostFromEnv = System.getenv("DB_HOST")
|
||||||
val isIdeaEnvironment = (dbHostFromEnv == null)
|
val isIdeaEnvironment = (dbHostFromEnv == null)
|
||||||
|
|
||||||
if (isIdeaEnvironment) {
|
if (useSqlite || isIdeaEnvironment) {
|
||||||
// Ensure the data directory exists
|
// Ensure the data directory exists
|
||||||
val dataDir = File("data")
|
val dataDir = File("data")
|
||||||
if (!dataDir.exists()) {
|
if (!dataDir.exists()) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package at.mocode.routes
|
package at.mocode.routes
|
||||||
|
|
||||||
import at.mocode.model.Bewerb
|
import at.mocode.model.Bewerb
|
||||||
|
import at.mocode.config.DependencyInjection
|
||||||
import at.mocode.repository.TurnierRepository
|
import at.mocode.repository.TurnierRepository
|
||||||
import at.mocode.views.AdminView
|
import at.mocode.views.AdminView
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
|
|
@ -15,7 +16,7 @@ import org.slf4j.LoggerFactory
|
||||||
*/
|
*/
|
||||||
fun Route.adminRoutes() {
|
fun Route.adminRoutes() {
|
||||||
val log = LoggerFactory.getLogger("AdminRoutes")
|
val log = LoggerFactory.getLogger("AdminRoutes")
|
||||||
val turnierRepository = TurnierRepository()
|
val turnierRepository = DependencyInjection.turnierRepository
|
||||||
val adminView = AdminView()
|
val adminView = AdminView()
|
||||||
|
|
||||||
// Route to display the tournament management page
|
// Route to display the tournament management page
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user