Skip to content

Commit 4bfbe62

Browse files
committed
Add support to specify filename
1 parent c44a535 commit 4bfbe62

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

api/surf-database-r2dbc.api

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ public final class dev/slne/surf/database/DatabaseApi {
66

77
public final class dev/slne/surf/database/DatabaseApi$Companion {
88
public final fun create (Lio/r2dbc/spi/ConnectionFactory;Lnet/kyori/adventure/text/logger/slf4j/ComponentLogger;Lorg/slf4j/event/Level;Lkotlin/jvm/functions/Function1;)Ldev/slne/surf/database/DatabaseApi;
9-
public final fun create (Ljava/nio/file/Path;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ldev/slne/surf/database/DatabaseApi;
9+
public final fun create (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ldev/slne/surf/database/DatabaseApi;
1010
public static synthetic fun create$default (Ldev/slne/surf/database/DatabaseApi$Companion;Lio/r2dbc/spi/ConnectionFactory;Lnet/kyori/adventure/text/logger/slf4j/ComponentLogger;Lorg/slf4j/event/Level;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/slne/surf/database/DatabaseApi;
11-
public static synthetic fun create$default (Ldev/slne/surf/database/DatabaseApi$Companion;Ljava/nio/file/Path;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/slne/surf/database/DatabaseApi;
11+
public static synthetic fun create$default (Ldev/slne/surf/database/DatabaseApi$Companion;Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/slne/surf/database/DatabaseApi;
1212
}
1313

1414
public abstract interface annotation class dev/slne/surf/database/TestOnlyDatabaseApi : java/lang/annotation/Annotation {
@@ -163,7 +163,8 @@ public final class dev/slne/surf/database/config/DatabaseConfig {
163163
}
164164

165165
public final class dev/slne/surf/database/config/DatabaseConfig$Companion {
166-
public final fun create (Ljava/nio/file/Path;)Ldev/slne/surf/database/config/DatabaseConfig;
166+
public final fun create (Ljava/nio/file/Path;Ljava/lang/String;)Ldev/slne/surf/database/config/DatabaseConfig;
167+
public static synthetic fun create$default (Ldev/slne/surf/database/config/DatabaseConfig$Companion;Ljava/nio/file/Path;Ljava/lang/String;ILjava/lang/Object;)Ldev/slne/surf/database/config/DatabaseConfig;
167168
}
168169

169170
public final class dev/slne/surf/database/config/DatabaseType : java/lang/Enum {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kotlin.stdlib.default.dependency=false
33
org.gradle.parallel=true
44
#org.gradle.caching=true
55
#org.gradle.configureondemand=true
6-
version=2.0.0
6+
version=2.0.1

src/main/kotlin/dev/slne/surf/database/DatabaseApi.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ class DatabaseApi internal constructor(val database: R2dbcDatabase) {
4545
@OptIn(TestOnlyDatabaseApi::class)
4646
fun create(
4747
pluginPath: Path,
48+
fileName: String = "database.yml",
4849
poolName: String = generatePoolName(),
4950
configCustomizer: R2dbcDatabaseConfig.Builder.() -> Unit = {}
5051
): DatabaseApi {
51-
val config = DatabaseConfig.create(pluginPath)
52+
val config = DatabaseConfig.create(pluginPath, fileName)
5253
val databaseType = config.credentials.databaseType
5354

5455
val connectionFactory: ConnectionFactory = when (databaseType) {

src/main/kotlin/dev/slne/surf/database/config/DatabaseConfig.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ data class DatabaseConfig(
1313
val pool: PoolConfig = PoolConfig()
1414
) {
1515
companion object {
16-
fun create(path: Path): DatabaseConfig {
17-
return surfConfigApi.createSpongeYmlConfig<DatabaseConfig>(path, "database.yml")
16+
fun create(
17+
path: Path,
18+
configName: String = "database.yml"
19+
): DatabaseConfig {
20+
return surfConfigApi.createSpongeYmlConfig<DatabaseConfig>(path, configName)
1821
}
1922
}
2023
}

0 commit comments

Comments
 (0)