Move BTC_NODES and USE_TOR_FOR_BTC to BtcOptionKeys

This commit is contained in:
Manfred Karrer 2017-02-25 13:23:35 -05:00
parent 60597cec88
commit ab01e97ddc
6 changed files with 15 additions and 15 deletions

View File

@ -8,6 +8,4 @@ public class AppOptionKeys {
public static final String APP_DATA_DIR_KEY = "appDataDir"; public static final String APP_DATA_DIR_KEY = "appDataDir";
public static final String MAX_MEMORY = "maxMemory"; public static final String MAX_MEMORY = "maxMemory";
public static final String PROVIDERS = "providers"; public static final String PROVIDERS = "providers";
public static final String BTC_NODES = "btcNodes";
public static final String USE_TOR_FOR_BTC = "useTorForBtc";
} }

View File

@ -181,12 +181,12 @@ public class BitsquareEnvironment extends StandardEnvironment {
(String) commandLineProperties.getProperty(NetworkOptionKeys.SOCKS_5_PROXY_HTTP_ADDRESS) : (String) commandLineProperties.getProperty(NetworkOptionKeys.SOCKS_5_PROXY_HTTP_ADDRESS) :
""; "";
btcNodes = commandLineProperties.containsProperty(AppOptionKeys.BTC_NODES) ? btcNodes = commandLineProperties.containsProperty(BtcOptionKeys.BTC_NODES) ?
(String) commandLineProperties.getProperty(AppOptionKeys.BTC_NODES) : (String) commandLineProperties.getProperty(BtcOptionKeys.BTC_NODES) :
""; "";
useTorForBtc = commandLineProperties.containsProperty(AppOptionKeys.USE_TOR_FOR_BTC) ? useTorForBtc = commandLineProperties.containsProperty(BtcOptionKeys.USE_TOR_FOR_BTC) ?
(String) commandLineProperties.getProperty(AppOptionKeys.USE_TOR_FOR_BTC) : (String) commandLineProperties.getProperty(BtcOptionKeys.USE_TOR_FOR_BTC) :
""; "";
MutablePropertySources propertySources = this.getPropertySources(); MutablePropertySources propertySources = this.getPropertySources();
@ -256,8 +256,8 @@ public class BitsquareEnvironment extends StandardEnvironment {
setProperty(RpcOptionKeys.RPC_BLOCK_PORT, rpcBlockPort); setProperty(RpcOptionKeys.RPC_BLOCK_PORT, rpcBlockPort);
setProperty(RpcOptionKeys.RPC_WALLET_PORT, rpcWalletPort); setProperty(RpcOptionKeys.RPC_WALLET_PORT, rpcWalletPort);
setProperty(AppOptionKeys.BTC_NODES, btcNodes); setProperty(BtcOptionKeys.BTC_NODES, btcNodes);
setProperty(AppOptionKeys.USE_TOR_FOR_BTC, useTorForBtc); setProperty(BtcOptionKeys.USE_TOR_FOR_BTC, useTorForBtc);
setProperty(UserAgent.NAME_KEY, appName); setProperty(UserAgent.NAME_KEY, appName);
setProperty(UserAgent.VERSION_KEY, Version.VERSION); setProperty(UserAgent.VERSION_KEY, Version.VERSION);

View File

@ -135,9 +135,9 @@ public abstract class BitsquareExecutable {
.withRequiredArg() .withRequiredArg()
.ofType(RegTestHost.class) .ofType(RegTestHost.class)
.withValuesConvertedBy(new EnumValueConverter(RegTestHost.class)); .withValuesConvertedBy(new EnumValueConverter(RegTestHost.class));
parser.accepts(AppOptionKeys.BTC_NODES, description("Custom nodes used for BitcoinJ as comma separated IP addresses.", "")) parser.accepts(BtcOptionKeys.BTC_NODES, description("Custom nodes used for BitcoinJ as comma separated IP addresses.", ""))
.withRequiredArg(); .withRequiredArg();
parser.accepts(AppOptionKeys.USE_TOR_FOR_BTC, description("If set to true BitcoinJ is routed over tor (socks 5 proxy).", "")) parser.accepts(BtcOptionKeys.USE_TOR_FOR_BTC, description("If set to true BitcoinJ is routed over tor (socks 5 proxy).", ""))
.withRequiredArg(); .withRequiredArg();
} }

View File

@ -54,8 +54,8 @@ public class BitcoinModule extends AppModule {
File walletDir = new File(env.getRequiredProperty(BtcOptionKeys.WALLET_DIR)); File walletDir = new File(env.getRequiredProperty(BtcOptionKeys.WALLET_DIR));
bind(File.class).annotatedWith(named(BtcOptionKeys.WALLET_DIR)).toInstance(walletDir); bind(File.class).annotatedWith(named(BtcOptionKeys.WALLET_DIR)).toInstance(walletDir);
bindConstant().annotatedWith(named(AppOptionKeys.BTC_NODES)).to(env.getRequiredProperty(AppOptionKeys.BTC_NODES)); bindConstant().annotatedWith(named(BtcOptionKeys.BTC_NODES)).to(env.getRequiredProperty(BtcOptionKeys.BTC_NODES));
bindConstant().annotatedWith(named(AppOptionKeys.USE_TOR_FOR_BTC)).to(env.getRequiredProperty(AppOptionKeys.USE_TOR_FOR_BTC)); bindConstant().annotatedWith(named(BtcOptionKeys.USE_TOR_FOR_BTC)).to(env.getRequiredProperty(BtcOptionKeys.USE_TOR_FOR_BTC));
bindConstant().annotatedWith(named(AppOptionKeys.PROVIDERS)).to(env.getRequiredProperty(AppOptionKeys.PROVIDERS)); bindConstant().annotatedWith(named(AppOptionKeys.PROVIDERS)).to(env.getRequiredProperty(AppOptionKeys.PROVIDERS));
bind(AddressEntryList.class).in(Singleton.class); bind(AddressEntryList.class).in(Singleton.class);

View File

@ -4,4 +4,6 @@ public class BtcOptionKeys {
public static final String BTC_NETWORK = "bitcoinNetwork"; public static final String BTC_NETWORK = "bitcoinNetwork";
public static final String REG_TEST_HOST = "bitcoinRegtestHost"; public static final String REG_TEST_HOST = "bitcoinRegtestHost";
public static final String WALLET_DIR = "walletDir"; public static final String WALLET_DIR = "walletDir";
public static final String BTC_NODES = "btcNodes";
public static final String USE_TOR_FOR_BTC = "useTorForBtc";
} }

View File

@ -17,11 +17,11 @@
package io.bitsquare.user; package io.bitsquare.user;
import io.bitsquare.app.AppOptionKeys;
import io.bitsquare.app.BitsquareEnvironment; import io.bitsquare.app.BitsquareEnvironment;
import io.bitsquare.app.DevFlags; import io.bitsquare.app.DevFlags;
import io.bitsquare.app.Version; import io.bitsquare.app.Version;
import io.bitsquare.btc.BitcoinNetwork; import io.bitsquare.btc.BitcoinNetwork;
import io.bitsquare.btc.BtcOptionKeys;
import io.bitsquare.btc.Restrictions; import io.bitsquare.btc.Restrictions;
import io.bitsquare.btc.provider.fee.FeeService; import io.bitsquare.btc.provider.fee.FeeService;
import io.bitsquare.common.persistance.Persistable; import io.bitsquare.common.persistance.Persistable;
@ -157,8 +157,8 @@ public final class Preferences implements Persistable {
@Inject @Inject
public Preferences(Storage<Preferences> storage, BitsquareEnvironment bitsquareEnvironment, public Preferences(Storage<Preferences> storage, BitsquareEnvironment bitsquareEnvironment,
FeeService feeService, FeeService feeService,
@Named(AppOptionKeys.BTC_NODES) String btcNodesFromOptions, @Named(BtcOptionKeys.BTC_NODES) String btcNodesFromOptions,
@Named(AppOptionKeys.USE_TOR_FOR_BTC) String useTorFlagFromOptions) { @Named(BtcOptionKeys.USE_TOR_FOR_BTC) String useTorFlagFromOptions) {
INSTANCE = this; INSTANCE = this;
this.storage = storage; this.storage = storage;
this.bitsquareEnvironment = bitsquareEnvironment; this.bitsquareEnvironment = bitsquareEnvironment;