commit 64f7a01eec0d5250edbc7e95ba65916008936bd4 parent 1777f8f4870074bdb84f7a2534280765167ac1d1 Author: MS <ms@taler.net> Date: Tue, 26 Jan 2021 15:24:42 +0100 fetch DB connections string from Env (Sandbox) Diffstat:
| M | sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | | | 7 | ++++--- |
1 file 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 @@ -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() {