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:
Michal Kit 2018-01-10 16:27:59 +00:00 committed by GitHub
parent 12546c0a7c
commit 4caf6d92ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 5 deletions

View File

@ -13,7 +13,7 @@ See the :doc:`signing-service` for a more detailed description of the service.
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:
.. literalinclude:: ../../network-management/hsm.conf

View File

@ -28,7 +28,7 @@ To run the HSM signing server:
```
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:

View File

@ -84,6 +84,7 @@ fun parseParameters(vararg args: String): NetworkManagementServerParameters {
.defaultsTo(Mode.DOORMAN.name)
}
// The config-file option is changed to configFile
val configFile = if (argConfig.hasPath("configFile")) {
Paths.get(argConfig.getString("configFile"))
} else {

View File

@ -61,9 +61,10 @@ data class Parameters(val dataSourceProperties: Properties,
fun parseParameters(vararg args: String): Parameters {
val argConfig = args.toConfigWithOptions {
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")) {
Paths.get(argConfig.getString("configFile"))
} else {

View File

@ -15,7 +15,7 @@ class ConfigurationTest : TestBase() {
@Test
fun `config file is parsed correctly`() {
val paramsWithPassword = parseParameters("--configFile", validConfigPath)
val paramsWithPassword = parseParameters("--config-file", validConfigPath)
assertEquals(AuthMode.PASSWORD, paramsWithPassword.authMode)
assertEquals("3001@192.168.0.1", paramsWithPassword.device)
}
@ -24,7 +24,7 @@ class ConfigurationTest : TestBase() {
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.
assertFailsWith<ConfigException.Missing> {
parseParameters("--configFile", invalidConfigPath)
parseParameters("--config-file", invalidConfigPath)
}
}