mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
[CORDA-1598] Make argument parsing more consistent. (#3423)
We parse command line arguments twice, once in `CordaCaplet.java` to determine the config file and base directory, and then again in NodeArgsParser. NodeArgsParser accepts long options with a single hyphen, while CordaCaplet did not. This changes CordaCaplet to accept `--config-file` as well as `-config-file`, same for base-dir.
This commit is contained in:
parent
b4d31b1c77
commit
79626e9c4c
@ -20,8 +20,16 @@ public class CordaCaplet extends Capsule {
|
||||
|
||||
private Config parseConfigFile(List<String> args) {
|
||||
String baseDirOption = getOption(args, "--base-directory");
|
||||
// Ensure consistent behaviour with NodeArgsParser.kt, see CORDA-1598.
|
||||
if (null == baseDirOption || baseDirOption.isEmpty()) {
|
||||
baseDirOption = getOption(args, "-base-directory");
|
||||
}
|
||||
this.baseDir = Paths.get((baseDirOption == null) ? "." : baseDirOption).toAbsolutePath().normalize().toString();
|
||||
String config = getOption(args, "--config-file");
|
||||
// Same as for baseDirOption.
|
||||
if (null == config || config.isEmpty()) {
|
||||
config = getOption(args, "-config-file");
|
||||
}
|
||||
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
|
||||
try {
|
||||
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user