From 5064cbb5c005a6526ec9413fc9c865fd731e1051 Mon Sep 17 00:00:00 2001 From: Patrick Kuo Date: Thu, 16 Feb 2017 14:47:20 +0000 Subject: [PATCH] Addressed PR issues --- doorman/src/main/kotlin/com/r3/corda/doorman/Main.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doorman/src/main/kotlin/com/r3/corda/doorman/Main.kt b/doorman/src/main/kotlin/com/r3/corda/doorman/Main.kt index a33f924131..93e0b6ec89 100644 --- a/doorman/src/main/kotlin/com/r3/corda/doorman/Main.kt +++ b/doorman/src/main/kotlin/com/r3/corda/doorman/Main.kt @@ -164,16 +164,18 @@ private fun DoormanParameters.startDoorman() { // Create DB connection. val (datasource, database) = configureDatabase(dataSourceProperties) + val requestStorage = DBCertificateRequestStorage(database) + val storage = if (jiraConfig == null) { logger.warn("Doorman server is in 'Approve All' mode, this will approve all incoming certificate signing request.") // Approve all pending request. - object : CertificationRequestStorage by DBCertificateRequestStorage(database) { + object : CertificationRequestStorage by requestStorage { // The doorman is in approve all mode, returns all pending request id as approved request id. override fun getApprovedRequestIds() = getPendingRequestIds() } } else { val jiraClient = AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(URI(jiraConfig.address), jiraConfig.username, jiraConfig.password) - JiraCertificateRequestStorage(DBCertificateRequestStorage(database), jiraClient, jiraConfig.projectCode, jiraConfig.doneTransitionCode) + JiraCertificateRequestStorage(requestStorage, jiraClient, jiraConfig.projectCode, jiraConfig.doneTransitionCode) } // Daemon thread approving request periodically.