Merge pull request #2090 from freimair/remove-defaults

Surgical fix to default command line parameters
This commit is contained in:
Manfred Karrer 2018-12-07 20:51:07 +01:00 committed by GitHub
commit fd2d2fd1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,14 +98,12 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
parser.allowsUnrecognizedOptions(); parser.allowsUnrecognizedOptions();
parser.accepts(AppOptionKeys.USER_DATA_DIR_KEY, parser.accepts(AppOptionKeys.USER_DATA_DIR_KEY,
"User data directory") format("User data directory (default: %s)", DEFAULT_USER_DATA_DIR))
.withRequiredArg() .withRequiredArg();
.defaultsTo(DEFAULT_USER_DATA_DIR);
parser.accepts(AppOptionKeys.APP_NAME_KEY, parser.accepts(AppOptionKeys.APP_NAME_KEY,
"Application name") format("Application name (default: %s)", DEFAULT_APP_NAME))
.withRequiredArg() .withRequiredArg();
.defaultsTo(DEFAULT_APP_NAME);
OptionSet options; OptionSet options;
try { try {
@ -327,10 +325,9 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
protected void customizeOptionParsing(OptionParser parser) { protected void customizeOptionParsing(OptionParser parser) {
//CommonOptionKeys //CommonOptionKeys
parser.accepts(CommonOptionKeys.LOG_LEVEL_KEY, parser.accepts(CommonOptionKeys.LOG_LEVEL_KEY,
"Log level") format("Log level (default: %s)", BisqEnvironment.LOG_LEVEL_DEFAULT))
.withRequiredArg() .withRequiredArg()
.describedAs("OFF|ALL|ERROR|WARN|INFO|DEBUG|TRACE") .describedAs("OFF|ALL|ERROR|WARN|INFO|DEBUG|TRACE");
.defaultsTo(BisqEnvironment.LOG_LEVEL_DEFAULT);
//NetworkOptionKeys //NetworkOptionKeys
parser.accepts(NetworkOptionKeys.SEED_NODES_KEY, parser.accepts(NetworkOptionKeys.SEED_NODES_KEY,
@ -351,22 +348,19 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
// use a fixed port as arbitrator use that for his ID // use a fixed port as arbitrator use that for his ID
parser.accepts(NetworkOptionKeys.PORT_KEY, parser.accepts(NetworkOptionKeys.PORT_KEY,
"Port to listen on") format("Port to listen on (default: %s)", "9999"))
.withRequiredArg() .withRequiredArg()
.ofType(int.class) .ofType(int.class);
.defaultsTo(9999);
parser.accepts(NetworkOptionKeys.USE_LOCALHOST_FOR_P2P, parser.accepts(NetworkOptionKeys.USE_LOCALHOST_FOR_P2P,
"Use localhost P2P network for development") format("Use localhost P2P network for development (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(NetworkOptionKeys.MAX_CONNECTIONS, parser.accepts(NetworkOptionKeys.MAX_CONNECTIONS,
"Max. connections a peer will try to keep") format("Max. connections a peer will try to keep (default: %s)", P2PService.MAX_CONNECTIONS_DEFAULT))
.withRequiredArg() .withRequiredArg()
.ofType(int.class) .ofType(int.class);
.defaultsTo(P2PService.MAX_CONNECTIONS_DEFAULT);
parser.accepts(NetworkOptionKeys.SOCKS_5_PROXY_BTC_ADDRESS, parser.accepts(NetworkOptionKeys.SOCKS_5_PROXY_BTC_ADDRESS,
"A proxy address to be used for Bitcoin network.") "A proxy address to be used for Bitcoin network.")
@ -420,66 +414,57 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
//AppOptionKeys //AppOptionKeys
parser.accepts(AppOptionKeys.USER_DATA_DIR_KEY, parser.accepts(AppOptionKeys.USER_DATA_DIR_KEY,
"User data directory") format("User data directory (default: %s)", BisqEnvironment.DEFAULT_USER_DATA_DIR))
.withRequiredArg() .withRequiredArg();
.defaultsTo(BisqEnvironment.DEFAULT_USER_DATA_DIR);
parser.accepts(AppOptionKeys.APP_NAME_KEY, parser.accepts(AppOptionKeys.APP_NAME_KEY,
"Application name") format("Application name (default: %s)", BisqEnvironment.DEFAULT_APP_NAME))
.withRequiredArg() .withRequiredArg();
.defaultsTo(BisqEnvironment.DEFAULT_APP_NAME);
parser.accepts(AppOptionKeys.MAX_MEMORY, parser.accepts(AppOptionKeys.MAX_MEMORY,
"Max. permitted memory (used only at headless versions)") format("Max. permitted memory (used only at headless versions) (default: %s)", "600"))
.withRequiredArg() .withRequiredArg();
.defaultsTo("600");
parser.accepts(AppOptionKeys.APP_DATA_DIR_KEY, parser.accepts(AppOptionKeys.APP_DATA_DIR_KEY,
"Application data directory") format("Application data directory (default: %s)", BisqEnvironment.DEFAULT_APP_DATA_DIR))
.withRequiredArg() .withRequiredArg();
.defaultsTo(BisqEnvironment.DEFAULT_APP_DATA_DIR);
parser.accepts(AppOptionKeys.IGNORE_DEV_MSG_KEY, parser.accepts(AppOptionKeys.IGNORE_DEV_MSG_KEY,
"If set to true all signed network_messages from bisq developers are ignored " + format("If set to true all signed network_messages from bisq developers are ignored " +
"(Global alert, Version update alert, Filters for offers, nodes or trading account data)") "(Global alert, Version update alert, Filters for offers, nodes or trading account data) (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.DESKTOP_WITH_HTTP_API, parser.accepts(AppOptionKeys.DESKTOP_WITH_HTTP_API,
"If set to true Bisq Desktop starts with Http API") format("If set to true Bisq Desktop starts with Http API (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.DESKTOP_WITH_GRPC_API, parser.accepts(AppOptionKeys.DESKTOP_WITH_GRPC_API,
"If set to true Bisq Desktop starts with gRPC API") format("If set to true Bisq Desktop starts with gRPC API (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS, parser.accepts(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS,
"If that is true all the privileged features which requires a private key " + format("If that is true all the privileged features which requires a private key " +
"to enable it are overridden by a dev key pair (This is for developers only!)") "to enable it are overridden by a dev key pair (This is for developers only!) (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.REFERRAL_ID, parser.accepts(AppOptionKeys.REFERRAL_ID,
"Optional Referral ID (e.g. for API users or pro market makers)") "Optional Referral ID (e.g. for API users or pro market makers)")
.withRequiredArg(); .withRequiredArg();
parser.accepts(CommonOptionKeys.USE_DEV_MODE, parser.accepts(CommonOptionKeys.USE_DEV_MODE,
"Enables dev mode which is used for convenience for developer testing") format("Enables dev mode which is used for convenience for developer testing (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.DUMP_STATISTICS, parser.accepts(AppOptionKeys.DUMP_STATISTICS,
"If set to true the trade statistics are stored as json file in the data dir.") format("If set to true the trade statistics are stored as json file in the data dir. (default: %s)",
"false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(AppOptionKeys.PROVIDERS, parser.accepts(AppOptionKeys.PROVIDERS,
"Custom providers (comma separated)") "Custom providers (comma separated)")
@ -493,10 +478,10 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.ofType(String.class) .ofType(String.class)
.describedAs(format("%s|%s|%s", BTC_MAINNET, BTC_TESTNET, BTC_REGTEST)); .describedAs(format("%s|%s|%s", BTC_MAINNET, BTC_TESTNET, BTC_REGTEST));
parser.accepts(BtcOptionKeys.REG_TEST_HOST) parser.accepts(BtcOptionKeys.REG_TEST_HOST,
format("(default: %s)", RegTestHost.DEFAULT))
.withRequiredArg() .withRequiredArg()
.ofType(RegTestHost.class) .ofType(RegTestHost.class);
.defaultsTo(RegTestHost.DEFAULT);
parser.accepts(BtcOptionKeys.BTC_NODES, parser.accepts(BtcOptionKeys.BTC_NODES,
"Custom nodes used for BitcoinJ as comma separated IP addresses.") "Custom nodes used for BitcoinJ as comma separated IP addresses.")
@ -508,11 +493,10 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.withRequiredArg(); .withRequiredArg();
parser.accepts(BtcOptionKeys.SOCKS5_DISCOVER_MODE, parser.accepts(BtcOptionKeys.SOCKS5_DISCOVER_MODE,
"Specify discovery mode for Bitcoin nodes. One or more of: [ADDR, DNS, ONION, ALL]" + format("Specify discovery mode for Bitcoin nodes. One or more of: [ADDR, DNS, ONION, ALL]" +
" (comma separated, they get OR'd together).") " (comma separated, they get OR'd together). (default: %s)", "ALL"))
.withRequiredArg() .withRequiredArg()
.describedAs("mode[,...]") .describedAs("mode[,...]");
.defaultsTo("ALL");
parser.accepts(BtcOptionKeys.USE_ALL_PROVIDED_NODES, parser.accepts(BtcOptionKeys.USE_ALL_PROVIDED_NODES,
"Set to true if connection of bitcoin nodes should include clear net nodes") "Set to true if connection of bitcoin nodes should include clear net nodes")
@ -523,9 +507,8 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.withRequiredArg(); .withRequiredArg();
parser.accepts(BtcOptionKeys.NUM_CONNECTIONS_FOR_BTC, parser.accepts(BtcOptionKeys.NUM_CONNECTIONS_FOR_BTC,
"Number of connections to the Bitcoin network") format("Number of connections to the Bitcoin network (default: %s)", "9"))
.withRequiredArg() .withRequiredArg();
.defaultsTo("9");
//RpcOptionKeys //RpcOptionKeys
parser.accepts(DaoOptionKeys.RPC_USER, parser.accepts(DaoOptionKeys.RPC_USER,
@ -545,11 +528,10 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.withRequiredArg(); .withRequiredArg();
parser.accepts(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA, parser.accepts(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA,
"If set to true the blockchain data from RPC requests to Bitcoin Core are " + format("If set to true the blockchain data from RPC requests to Bitcoin Core are " +
"stored as json file in the data dir.") "stored as json file in the data dir. (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
parser.accepts(DaoOptionKeys.FULL_DAO_NODE, parser.accepts(DaoOptionKeys.FULL_DAO_NODE,
"If set to true the node requests the blockchain data via RPC requests " + "If set to true the node requests the blockchain data via RPC requests " +
@ -562,15 +544,13 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.withRequiredArg(); .withRequiredArg();
parser.accepts(DaoOptionKeys.GENESIS_BLOCK_HEIGHT, parser.accepts(DaoOptionKeys.GENESIS_BLOCK_HEIGHT,
"Genesis transaction block height when not using the hard coded one") format("Genesis transaction block height when not using the hard coded one (default: %s)", "-1"))
.withRequiredArg() .withRequiredArg();
.defaultsTo("-1");
parser.accepts(DaoOptionKeys.DAO_ACTIVATED, parser.accepts(DaoOptionKeys.DAO_ACTIVATED,
"Developer flag. If true it enables dao phase 2 features.") format("Developer flag. If true it enables dao phase 2 features. (default: %s)", "false"))
.withRequiredArg() .withRequiredArg()
.ofType(boolean.class) .ofType(boolean.class);
.defaultsTo(false);
} }
public static BisqEnvironment getBisqEnvironment(OptionSet options) { public static BisqEnvironment getBisqEnvironment(OptionSet options) {