Skip to content

Commit fd7e969

Browse files
committed
Forenkle ytterligere
1 parent 9030514 commit fd7e969

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/main/kotlin/Database.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class Database(
2222
Flyway
2323
.configure()
2424
.dataSource(dataSource)
25-
.lockRetryCount(50)
2625
.load()
2726
.migrate()
2827
}.close()

src/main/kotlin/Env.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ object Env {
2121
}
2222

2323
object Database {
24-
val url = "NAIS_DATABASE_DIALOG_DIALOG_JDBC_URL".fromEnv()
25-
val username = "NAIS_DATABASE_DIALOG_DIALOG_USERNAME".fromEnv()
26-
val password = "NAIS_DATABASE_DIALOG_DIALOG_PASSWORD".fromEnv()
27-
val name = "NAIS_DATABASE_DIALOG_DIALOG_DATABASE".fromEnv()
24+
private val databasePrefix = "NAIS_DATABASE_DIALOG_DIALOG"
25+
val url = "${databasePrefix}_JDBC_URL".fromEnv()
26+
val username = "${databasePrefix}_USERNAME".fromEnv()
27+
val password = "${databasePrefix}_PASSWORD".fromEnv()
28+
val name = "${databasePrefix}_DATABASE".fromEnv()
2829
}
2930

3031
val navArbeidsgiverApiBaseUrl = "NAV_ARBEIDSGIVER_API_BASEURL".fromEnv()

src/test/kotlin/FunSpecWithDb.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ abstract class FunSpecWithDb(
2525
body(db.db)
2626
})
2727

28-
fun postgresContainer(): PostgreSQLContainer<Nothing> =
29-
PostgreSQLContainer<Nothing>("postgres:17").apply {
30-
setCommand("postgres", "-c", "fsync=off", "-c", "log_statement=all", "-c", "wal_level=logical")
31-
}
32-
3328
private fun PostgreSQLContainer<Nothing>.setupAndStart(): PostgreSQLContainer<Nothing> =
3429
apply {
3530
withReuse(true)
@@ -41,7 +36,7 @@ private fun PostgreSQLContainer<Nothing>.setupAndStart(): PostgreSQLContainer<No
4136
}
4237

4338
private fun dbConfig(): HikariConfig {
44-
val postgres = postgresContainer().setupAndStart()
39+
val postgres = PostgreSQLContainer<Nothing>("postgres:17").setupAndStart()
4540
return HikariConfig().apply {
4641
jdbcUrl = postgres.jdbcUrl
4742
username = postgres.username

0 commit comments

Comments
 (0)