added optional config property for keystore file path (#748)

This commit is contained in:
Patrick Kuo 2018-04-18 17:10:04 +01:00 committed by GitHub
parent 9cbf7fd7ab
commit ac99b81ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,8 @@ networkRootTrustStorePassword Network root trust store password, to be provide
keyStorePassword Generated keystore's password. Optional, the tool will prompt for password input if not provided.
trustStorePassword Generated trust store's password. Optional, the tool will prompt for password input if not provided.
keystorePath [Optional] Path of the generated keystore file, default to certificates/notaryidentitykeystore.jks
```
Example config file

View File

@ -43,6 +43,7 @@ fun RegistrationOption.runRegistration() {
override val trustStorePassword: String by lazy { config.trustStorePassword ?: readPassword("Node TrustStore password:") }
val parent = configFile.parent
override val certificatesDirectory: Path = if (parent != null) parent / "certificates" else Paths.get("certificates")
override val nodeKeystore: Path get() = config.keystorePath ?: certificatesDirectory/"notaryidentitykeystore.jks"
}
NetworkRegistrationHelper(sslConfig,
@ -59,4 +60,5 @@ data class NotaryRegistrationConfig(val legalName: CordaX500Name,
val networkRootTrustStorePath: Path,
val keyStorePassword: String?,
val networkRootTrustStorePassword: String?,
val trustStorePassword: String?)
val trustStorePassword: String?,
val keystorePath: Path?)

View File

@ -32,6 +32,7 @@ legalName {
email = "test@email.com"
compatibilityZoneURL = "http://doorman.url.com"
networkRootTrustStorePath = "networkRootTrustStore.jks"
keystorePath = "notaryidentitykeystore.jks"
networkRootTrustStorePassword = "password"
keyStorePassword = "password"
@ -47,5 +48,6 @@ trustStorePassword = "password"
assertEquals("test@email.com", config.email)
assertEquals(Paths.get("networkRootTrustStore.jks"), config.networkRootTrustStorePath)
assertEquals("password", config.networkRootTrustStorePassword)
assertEquals(Paths.get("notaryidentitykeystore.jks"), config.keystorePath)
}
}