mirror of
https://github.com/corda/corda.git
synced 2024-12-27 08:22:35 +00:00
Cherry picked commit from the release DEV preview branch. This is the fix for the database config not being honoured by doorman (#408)
This commit is contained in:
parent
1be4f0950d
commit
5f1590d97f
@ -35,7 +35,7 @@ Allowed parameters are:
|
||||
|
||||
:approveAll: Whether to approve all request (defaults to false), this is for debug only.
|
||||
|
||||
:databaseProperties: database properties
|
||||
:database: database properties. The same (including its default value) as for node configuration (see :doc:`corda-configuration-file`).
|
||||
|
||||
:dataSourceProperties: datasource properties
|
||||
|
||||
|
@ -12,6 +12,11 @@ dataSourceProperties {
|
||||
"dataSource.user" = sa
|
||||
"dataSource.password" = ""
|
||||
}
|
||||
|
||||
database {
|
||||
runMigration = true
|
||||
}
|
||||
|
||||
h2port = 0
|
||||
|
||||
# Comment out this section if running without doorman service
|
||||
|
@ -7,6 +7,7 @@ import net.corda.core.internal.div
|
||||
import net.corda.core.internal.isRegularFile
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.nodeapi.internal.config.parseAs
|
||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
@ -15,7 +16,7 @@ data class NetworkManagementServerParameters(// TODO: Move local signing to sign
|
||||
val host: String,
|
||||
val port: Int,
|
||||
val dataSourceProperties: Properties,
|
||||
val databaseProperties: Properties? = null,
|
||||
val database: DatabaseConfig = DatabaseConfig(),
|
||||
val mode: Mode,
|
||||
|
||||
val doormanConfig: DoormanConfig?,
|
||||
|
@ -8,26 +8,20 @@ import com.r3.corda.networkmanage.common.utils.CertPathAndKey
|
||||
import com.r3.corda.networkmanage.common.utils.ShowHelpException
|
||||
import com.r3.corda.networkmanage.doorman.signer.LocalSigner
|
||||
import com.r3.corda.networkmanage.hsm.configuration.Parameters.Companion.DEFAULT_CSR_CERTIFICATE_NAME
|
||||
import net.corda.core.crypto.Crypto
|
||||
import net.corda.core.crypto.SignatureScheme
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.internal.createDirectories
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.core.serialization.internal.SerializationEnvironmentImpl
|
||||
import net.corda.core.serialization.internal.nodeSerializationEnv
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.nodeapi.internal.crypto.*
|
||||
import net.corda.nodeapi.internal.crypto.getCertificateAndKeyPair
|
||||
import net.corda.nodeapi.internal.crypto.getSupportedKey
|
||||
import net.corda.nodeapi.internal.crypto.loadOrCreateKeyStore
|
||||
import net.corda.nodeapi.internal.network.NetworkParameters
|
||||
import net.corda.nodeapi.internal.serialization.AMQP_P2P_CONTEXT
|
||||
import net.corda.nodeapi.internal.serialization.SerializationFactoryImpl
|
||||
import net.corda.nodeapi.internal.serialization.amqp.AMQPClientSerializationScheme
|
||||
import org.bouncycastle.pkcs.PKCS10CertificationRequest
|
||||
import java.nio.file.Path
|
||||
import java.security.cert.X509Certificate
|
||||
import java.time.Instant
|
||||
import javax.security.auth.x500.X500Principal
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
data class NetworkMapStartParams(val signer: LocalSigner?, val updateNetworkParameters: NetworkParameters?, val config: NetworkMapConfig)
|
||||
|
||||
@ -84,7 +78,7 @@ fun main(args: Array<String>) {
|
||||
caPrivateKeyPassword)
|
||||
Mode.DOORMAN -> {
|
||||
initialiseSerialization()
|
||||
val database = configureDatabase(dataSourceProperties)
|
||||
val persistence = configureDatabase(dataSourceProperties, database)
|
||||
// TODO: move signing to signing server.
|
||||
val csrAndNetworkMap = processKeyStore(this)
|
||||
|
||||
@ -103,7 +97,7 @@ fun main(args: Array<String>) {
|
||||
NetworkMapStartParams(csrAndNetworkMap?.second, networkParameters, it)
|
||||
}
|
||||
|
||||
networkManagementServer.start(NetworkHostAndPort(host, port), database, csrAndNetworkMap?.first, doormanConfig, networkMapStartParams)
|
||||
networkManagementServer.start(NetworkHostAndPort(host, port), persistence, csrAndNetworkMap?.first, doormanConfig, networkMapStartParams)
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(thread(start = false) {
|
||||
networkManagementServer.close()
|
||||
|
@ -10,6 +10,7 @@ import java.lang.reflect.InvocationTargetException
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFailsWith
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DoormanParametersTest {
|
||||
private val validOverrideNetworkConfigPath = File("network-parameters.conf").absolutePath
|
||||
@ -48,12 +49,9 @@ class DoormanParametersTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should parse jira config correctly`() {
|
||||
val parameter = parseParameters(*validArgs).doormanConfig!!
|
||||
assertEquals("https://doorman-jira-host.com/", parameter.jiraConfig?.address)
|
||||
assertEquals("TD", parameter.jiraConfig?.projectCode)
|
||||
assertEquals("username", parameter.jiraConfig?.username)
|
||||
assertEquals("password", parameter.jiraConfig?.password)
|
||||
fun `should parse database config correctly`() {
|
||||
val parameter = parseParameters(*validArgs).database
|
||||
assertTrue(parameter.runMigration)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user