Skip to content

Commit 3810a55

Browse files
Add dedicated MariaDB support
Add maxLifetime config option
1 parent 9c887cd commit 3810a55

File tree

10 files changed

+90
-48
lines changed

10 files changed

+90
-48
lines changed

build.gradle

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4+
15
plugins {
2-
id 'fabric-loom' version '1.6.+'
6+
id 'fabric-loom' version '1.12.7'
37
id 'maven-publish'
4-
id 'org.jetbrains.kotlin.jvm' version "1.8.22"
8+
id 'org.jetbrains.kotlin.jvm' version "2.2.21"
59
}
610

7-
sourceCompatibility = JavaVersion.VERSION_17
8-
targetCompatibility = JavaVersion.VERSION_17
11+
java {
12+
sourceCompatibility = JavaVersion.VERSION_17
13+
targetCompatibility = JavaVersion.VERSION_17
14+
}
915

10-
archivesBaseName = project.archives_base_name
16+
base {
17+
archivesName = project.archives_base_name
18+
}
1119
version = project.mod_version
1220
group = project.maven_group
1321

1422
repositories {
23+
mavenCentral()
1524
mavenLocal()
1625
maven {
1726
url = "https://maven.nucleoid.xyz"
@@ -45,6 +54,8 @@ dependencies {
4554

4655
// PostgreSQL
4756
implementation(include("org.postgresql:postgresql:42.7.3"))
57+
58+
modImplementation("me.lucko:fabric-permissions-api:0.3")
4859
}
4960

5061
processResources {
@@ -61,6 +72,12 @@ tasks.withType(JavaCompile).configureEach {
6172
it.options.release = 17
6273
}
6374

75+
tasks.withType(KotlinCompile).configureEach {
76+
it.compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_8
77+
it.compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_8
78+
it.compilerOptions.jvmTarget = JvmTarget.JVM_17
79+
}
80+
6481
java {
6582
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
6683
// if it is present.
@@ -70,7 +87,7 @@ java {
7087

7188
jar {
7289
from("LICENSE") {
73-
rename { "${it}_${project.archivesBaseName}"}
90+
rename { "${it}_${project.archives_base_name}"}
7491
}
7592
}
7693

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ org.gradle.jvmargs=-Xmx2G
88
loader_version=0.14.8
99

1010
# Mod Properties
11-
mod_version = 1.2.0
11+
mod_version = 1.2.1
1212
maven_group = net.quiltservertools
1313
archives_base_name = ledger-databases

gradle/wrapper/gradle-wrapper.jar

-13.6 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

Lines changed: 36 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 22 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/net/quiltservertools/ledger/databases/DatabaseExtensionSpec.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.quiltservertools.ledger.databases
22

33
import com.uchuhimo.konf.ConfigSpec
4+
import java.util.concurrent.TimeUnit.MINUTES
45

56
object DatabaseExtensionSpec : ConfigSpec("database_extensions") {
67
val database by required<Databases>("database")
@@ -10,4 +11,5 @@ object DatabaseExtensionSpec : ConfigSpec("database_extensions") {
1011
val properties by optional(mapOf<String, String>(), "properties")
1112
val maxPoolSize by optional(10, "maxPoolSize")
1213
val connectionTimeout by optional(60000L, "connectionTimeout")
14+
val maxLifetime by optional(MINUTES.toMillis(30), "maxLifetime")
1315
}

src/main/kotlin/net/quiltservertools/ledger/databases/databases/MariaDB.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ object MariaDB : LedgerDatabase {
1515
password = Ledger.config[DatabaseExtensionSpec.password]
1616
maximumPoolSize = Ledger.config[DatabaseExtensionSpec.maxPoolSize]
1717
connectionTimeout = Ledger.config[DatabaseExtensionSpec.connectionTimeout]
18+
maxLifetime = Ledger.config[DatabaseExtensionSpec.maxLifetime]
1819
addDataSourceProperty("rewriteBatchedStatements", "true")
1920
addDataSourceProperty("cachePrepStmts", true)
2021
addDataSourceProperty("prepStmtCacheSize", 250)

src/main/kotlin/net/quiltservertools/ledger/databases/databases/MySQL.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ object MySQL : LedgerDatabase {
1515
password = Ledger.config[DatabaseExtensionSpec.password]
1616
maximumPoolSize = Ledger.config[DatabaseExtensionSpec.maxPoolSize]
1717
connectionTimeout = Ledger.config[DatabaseExtensionSpec.connectionTimeout]
18+
maxLifetime = Ledger.config[DatabaseExtensionSpec.maxLifetime]
1819
addDataSourceProperty("rewriteBatchedStatements", "true")
1920
addDataSourceProperty("cachePrepStmts", true)
2021
addDataSourceProperty("prepStmtCacheSize", 250)

src/main/kotlin/net/quiltservertools/ledger/databases/databases/PostgreSQL.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ object PostgreSQL : LedgerDatabase {
1414
username = Ledger.config[DatabaseExtensionSpec.userName]
1515
password = Ledger.config[DatabaseExtensionSpec.password]
1616
maximumPoolSize = Ledger.config[DatabaseExtensionSpec.maxPoolSize]
17+
maxLifetime = Ledger.config[DatabaseExtensionSpec.maxLifetime]
1718
addDataSourceProperty("reWriteBatchedInserts", "true")
1819
for ((key, value) in Ledger.config[DatabaseExtensionSpec.properties]) {
1920
addDataSourceProperty(key, value)

0 commit comments

Comments
 (0)