mirror of
https://github.com/corda/corda.git
synced 2024-12-30 17:57:02 +00:00
ENT-1350 unifying the config-file command line argument (#333)
* ENT-1350 unifying the config-file command line argument * Changing README.md
This commit is contained in:
parent
12546c0a7c
commit
4caf6d92ea
@ -13,7 +13,7 @@ See the :doc:`signing-service` for a more detailed description of the service.
|
|||||||
|
|
||||||
Configuration file
|
Configuration file
|
||||||
------------------
|
------------------
|
||||||
At startup the signing service reads a configuration file, passed with ``--configFile`` on the command line.
|
At startup the signing service reads a configuration file, passed with ``--config-file`` on the command line.
|
||||||
|
|
||||||
This is an example of what a signing service configuration file might look like:
|
This is an example of what a signing service configuration file might look like:
|
||||||
.. literalinclude:: ../../network-management/hsm.conf
|
.. literalinclude:: ../../network-management/hsm.conf
|
||||||
|
@ -28,7 +28,7 @@ To run the HSM signing server:
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd network-management
|
cd network-management
|
||||||
java -jar capsule-hsm/build/libs/hsm-<version>.jar --configFile hsm.conf
|
java -jar capsule-hsm/build/libs/hsm-<version>.jar --config-file hsm.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
For a list of options the HSM signing server takes, run with the `--help` option:
|
For a list of options the HSM signing server takes, run with the `--help` option:
|
||||||
|
@ -84,6 +84,7 @@ fun parseParameters(vararg args: String): NetworkManagementServerParameters {
|
|||||||
.defaultsTo(Mode.DOORMAN.name)
|
.defaultsTo(Mode.DOORMAN.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The config-file option is changed to configFile
|
||||||
val configFile = if (argConfig.hasPath("configFile")) {
|
val configFile = if (argConfig.hasPath("configFile")) {
|
||||||
Paths.get(argConfig.getString("configFile"))
|
Paths.get(argConfig.getString("configFile"))
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,9 +61,10 @@ data class Parameters(val dataSourceProperties: Properties,
|
|||||||
fun parseParameters(vararg args: String): Parameters {
|
fun parseParameters(vararg args: String): Parameters {
|
||||||
val argConfig = args.toConfigWithOptions {
|
val argConfig = args.toConfigWithOptions {
|
||||||
accepts("basedir", "Overriding configuration filepath, default to current directory.").withRequiredArg().defaultsTo(".").describedAs("filepath")
|
accepts("basedir", "Overriding configuration filepath, default to current directory.").withRequiredArg().defaultsTo(".").describedAs("filepath")
|
||||||
accepts("configFile", "Overriding configuration file.").withRequiredArg().defaultsTo("node.conf").describedAs("filepath")
|
accepts("config-file", "Overriding configuration file.").withRequiredArg().describedAs("filepath")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The config-file option is changed to configFile
|
||||||
val configFile = if (argConfig.hasPath("configFile")) {
|
val configFile = if (argConfig.hasPath("configFile")) {
|
||||||
Paths.get(argConfig.getString("configFile"))
|
Paths.get(argConfig.getString("configFile"))
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,7 +15,7 @@ class ConfigurationTest : TestBase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `config file is parsed correctly`() {
|
fun `config file is parsed correctly`() {
|
||||||
val paramsWithPassword = parseParameters("--configFile", validConfigPath)
|
val paramsWithPassword = parseParameters("--config-file", validConfigPath)
|
||||||
assertEquals(AuthMode.PASSWORD, paramsWithPassword.authMode)
|
assertEquals(AuthMode.PASSWORD, paramsWithPassword.authMode)
|
||||||
assertEquals("3001@192.168.0.1", paramsWithPassword.device)
|
assertEquals("3001@192.168.0.1", paramsWithPassword.device)
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ class ConfigurationTest : TestBase() {
|
|||||||
fun `should fail when config missing database source properties`() {
|
fun `should fail when config missing database source properties`() {
|
||||||
// dataSourceProperties is missing from node_fail.conf and it should fail during parsing, and shouldn't use default from reference.conf.
|
// dataSourceProperties is missing from node_fail.conf and it should fail during parsing, and shouldn't use default from reference.conf.
|
||||||
assertFailsWith<ConfigException.Missing> {
|
assertFailsWith<ConfigException.Missing> {
|
||||||
parseParameters("--configFile", invalidConfigPath)
|
parseParameters("--config-file", invalidConfigPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user