From 64f7a01eec0d5250edbc7e95ba65916008936bd4 Mon Sep 17 00:00:00 2001 From: MS Date: Tue, 26 Jan 2021 15:24:42 +0100 Subject: fetch DB connections string from Env (Sandbox) --- 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 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() { -- cgit v1.2.3