CORDA-3240: optional node.conf property not recognized when overridden (#5505)

* CORDA-3240: optional node.conf property not recognized when overridden

* CORDA-3240: address detekt issues

* [NOTICK]: undo incorrectly commmented out include
This commit is contained in:
bpaunescu 2019-09-25 10:34:26 +01:00 committed by GitHub
parent 5f95b54862
commit 4672c3a13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 4 deletions

View File

@ -375,7 +375,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
signedNodeInfo, signedNodeInfo,
netParams, netParams,
keyManagementService, keyManagementService,
configuration.networkParameterAcceptanceSettings) configuration.networkParameterAcceptanceSettings!!)
try { try {
startMessagingService(rpcOps, nodeInfo, myNotaryIdentity, netParams) startMessagingService(rpcOps, nodeInfo, myNotaryIdentity, netParams)
} catch (e: Exception) { } catch (e: Exception) {

View File

@ -81,7 +81,7 @@ interface NodeConfiguration {
val cordappSignerKeyFingerprintBlacklist: List<String> val cordappSignerKeyFingerprintBlacklist: List<String>
val networkParameterAcceptanceSettings: NetworkParameterAcceptanceSettings val networkParameterAcceptanceSettings: NetworkParameterAcceptanceSettings?
val blacklistedAttachmentSigningKeys: List<String> val blacklistedAttachmentSigningKeys: List<String>

View File

@ -75,7 +75,8 @@ data class NodeConfigurationImpl(
override val jmxReporterType: JmxReporterType? = Defaults.jmxReporterType, override val jmxReporterType: JmxReporterType? = Defaults.jmxReporterType,
override val flowOverrides: FlowOverrideConfig?, override val flowOverrides: FlowOverrideConfig?,
override val cordappSignerKeyFingerprintBlacklist: List<String> = Defaults.cordappSignerKeyFingerprintBlacklist, override val cordappSignerKeyFingerprintBlacklist: List<String> = Defaults.cordappSignerKeyFingerprintBlacklist,
override val networkParameterAcceptanceSettings: NetworkParameterAcceptanceSettings = Defaults.networkParameterAcceptanceSettings, override val networkParameterAcceptanceSettings: NetworkParameterAcceptanceSettings? =
Defaults.networkParameterAcceptanceSettings,
override val blacklistedAttachmentSigningKeys: List<String> = Defaults.blacklistedAttachmentSigningKeys override val blacklistedAttachmentSigningKeys: List<String> = Defaults.blacklistedAttachmentSigningKeys
) : NodeConfiguration { ) : NodeConfiguration {
internal object Defaults { internal object Defaults {

View File

@ -21,6 +21,7 @@ import net.corda.node.services.config.DevModeOptions
import net.corda.node.services.config.FlowOverride import net.corda.node.services.config.FlowOverride
import net.corda.node.services.config.FlowOverrideConfig import net.corda.node.services.config.FlowOverrideConfig
import net.corda.node.services.config.FlowTimeoutConfiguration import net.corda.node.services.config.FlowTimeoutConfiguration
import net.corda.node.services.config.NetworkParameterAcceptanceSettings
import net.corda.node.services.config.NetworkServicesConfig import net.corda.node.services.config.NetworkServicesConfig
import net.corda.node.services.config.NodeH2Settings import net.corda.node.services.config.NodeH2Settings
import net.corda.node.services.config.NodeRpcSettings import net.corda.node.services.config.NodeRpcSettings
@ -143,6 +144,18 @@ internal object NetworkServicesConfigSpec : Configuration.Specification<NetworkS
} }
} }
internal object NetworkParameterAcceptanceSettingsSpec :
Configuration.Specification<NetworkParameterAcceptanceSettings>("NetworkParameterAcceptanceSettings") {
private val autoAcceptEnabled by boolean().optional().withDefaultValue(true)
private val excludedAutoAcceptableParameters by string().listOrEmpty()
override fun parseValid(configuration: Config): Valid<NetworkParameterAcceptanceSettings> {
return valid(NetworkParameterAcceptanceSettings(configuration[autoAcceptEnabled],
configuration[excludedAutoAcceptableParameters].toSet())
)
}
}
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
internal object CertChainPolicyConfigSpec : Configuration.Specification<CertChainPolicyConfig>("CertChainPolicyConfig") { internal object CertChainPolicyConfigSpec : Configuration.Specification<CertChainPolicyConfig>("CertChainPolicyConfig") {
private val role by string() private val role by string()

View File

@ -58,6 +58,9 @@ internal object V1NodeConfigurationSpec : Configuration.Specification<NodeConfig
private val cordappDirectories by string().mapValid(::toPath).list().optional() private val cordappDirectories by string().mapValid(::toPath).list().optional()
private val cordappSignerKeyFingerprintBlacklist by string().list().optional().withDefaultValue(Defaults.cordappSignerKeyFingerprintBlacklist) private val cordappSignerKeyFingerprintBlacklist by string().list().optional().withDefaultValue(Defaults.cordappSignerKeyFingerprintBlacklist)
private val blacklistedAttachmentSigningKeys by string().list().optional().withDefaultValue(Defaults.blacklistedAttachmentSigningKeys) private val blacklistedAttachmentSigningKeys by string().list().optional().withDefaultValue(Defaults.blacklistedAttachmentSigningKeys)
private val networkParameterAcceptanceSettings by nested(NetworkParameterAcceptanceSettingsSpec)
.optional()
.withDefaultValue(Defaults.networkParameterAcceptanceSettings)
@Suppress("unused") @Suppress("unused")
private val custom by nestedObject().optional() private val custom by nestedObject().optional()
@Suppress("unused") @Suppress("unused")
@ -117,7 +120,8 @@ internal object V1NodeConfigurationSpec : Configuration.Specification<NodeConfig
jarDirs = configuration[jarDirs], jarDirs = configuration[jarDirs],
cordappDirectories = cordappDirectories.map { baseDirectoryPath.resolve(it) }, cordappDirectories = cordappDirectories.map { baseDirectoryPath.resolve(it) },
cordappSignerKeyFingerprintBlacklist = configuration[cordappSignerKeyFingerprintBlacklist], cordappSignerKeyFingerprintBlacklist = configuration[cordappSignerKeyFingerprintBlacklist],
blacklistedAttachmentSigningKeys = configuration[blacklistedAttachmentSigningKeys] blacklistedAttachmentSigningKeys = configuration[blacklistedAttachmentSigningKeys],
networkParameterAcceptanceSettings = configuration[networkParameterAcceptanceSettings]
)) ))
} catch (e: Exception) { } catch (e: Exception) {
return when (e) { return when (e) {