summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-01-26 15:24:42 +0100
committerMS <ms@taler.net>2021-01-26 15:24:42 +0100
commit64f7a01eec0d5250edbc7e95ba65916008936bd4 (patch)
treeba04b13c7c90483b930afb90ac6e810a411e088c
parent1777f8f4870074bdb84f7a2534280765167ac1d1 (diff)
downloadlibeufin-64f7a01eec0d5250edbc7e95ba65916008936bd4.tar.gz
libeufin-64f7a01eec0d5250edbc7e95ba65916008936bd4.tar.bz2
libeufin-64f7a01eec0d5250edbc7e95ba65916008936bd4.zip
fetch DB connections string from Env (Sandbox)
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 4941d817..b0406aab 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -82,7 +82,8 @@ import tech.libeufin.util.ebics_h004.EbicsTypes
import java.util.*
import kotlin.random.Random
-const val DEFAULT_DB_CONNECTION = "jdbc:sqlite:/tmp/libeufin-sandbox.sqlite3"
+val LIBEUFIN_SANDBOX_DB_CONNECTION = System.getenv(
+ "LIBEUFIN_SANDBOX_DB_CONNECTION") ?: "jdbc:sqlite:/tmp/libeufin-sandbox.sqlite3"
class CustomerNotFound(id: String?) : Exception("Customer ${id} not found")
class BadInputData(inputData: String?) : Exception("Customer provided invalid input data: ${inputData}")
@@ -103,7 +104,7 @@ class ResetTables : CliktCommand("Drop all the tables from the database") {
}
}
- private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
+ private val dbConnString by option().default(LIBEUFIN_SANDBOX_DB_CONNECTION)
override fun run() {
execThrowableOrTerminate {
dbDropTables(dbConnString)
@@ -119,7 +120,7 @@ class Serve : CliktCommand("Run sandbox HTTP server") {
}
}
- private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
+ private val dbConnString by option().default(LIBEUFIN_SANDBOX_DB_CONNECTION)
private val logLevel by option()
private val port by option().int().default(5000)
override fun run() {