[+] Check sqlite before application start

pull/23/head
Azalea 2024-03-20 17:54:16 -04:00
parent 9155bfb886
commit 59b17aa47e
2 changed files with 19 additions and 0 deletions

View File

@ -14,6 +14,7 @@ plugins {
id("io.freefair.lombok") version "8.6"
id("org.springframework.boot") version "3.2.3"
id("com.github.ben-manes.versions") version "0.51.0"
application
}
apply(plugin = "io.spring.dependency-management")

View File

@ -0,0 +1,18 @@
package icu.samnyan.aqua.spring
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Configuration
import java.lang.System.err
import kotlin.system.exitProcess
@Configuration
class DataSourceConfig(@Value("\${spring.datasource.url}") val databaseUrl: String) {
init {
if (databaseUrl.lowercase().contains("jdbc:sqlite:", ignoreCase = true)) {
err.println("!!! ERROR !!!\n" +
"SQLite isn't supported in the v1 development branch yet.\n" +
"Please either switch to MariaDB or wait for the stable v1 release.\n")
exitProcess(1)
}
}
}