mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Finish moving 'nodePort' option handling to Config
This commit is contained in:
parent
c56c06d939
commit
ef7196ef8a
@ -41,9 +41,9 @@ public class Config {
|
||||
public static final String LOG_LEVEL = "logLevel";
|
||||
public static final String SEED_NODES = "seedNodes";
|
||||
public static final String BAN_LIST = "banList";
|
||||
public static final String NODE_PORT = "nodePort";
|
||||
|
||||
static final String DEFAULT_CONFIG_FILE_NAME = "bisq.properties";
|
||||
static final int DEFAULT_NODE_PORT = 9999;
|
||||
|
||||
public static File CURRENT_APP_DATA_DIR;
|
||||
|
||||
@ -129,10 +129,10 @@ public class Config {
|
||||
.defaultsTo(defaultAppDataDir);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Integer> nodePortOpt =
|
||||
parser.accepts("nodePort", "Port to listen on")
|
||||
parser.accepts(NODE_PORT, "Port to listen on")
|
||||
.withRequiredArg()
|
||||
.ofType(Integer.class)
|
||||
.defaultsTo(DEFAULT_NODE_PORT);
|
||||
.defaultsTo(9999);
|
||||
|
||||
ArgumentAcceptingOptionSpec<String> bannedBtcNodesOpt =
|
||||
parser.accepts("bannedBtcNodes", "List Bitcoin nodes to ban")
|
||||
|
@ -276,12 +276,6 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
|
||||
|
||||
protected void customizeOptionParsing(OptionParser parser) {
|
||||
//NetworkOptionKeys
|
||||
// use a fixed port as arbitrator use that for his ID
|
||||
parser.accepts(NetworkOptionKeys.PORT_KEY,
|
||||
format("Port to listen on (default: %s)", "9999"))
|
||||
.withRequiredArg()
|
||||
.ofType(int.class);
|
||||
|
||||
parser.accepts(NetworkOptionKeys.USE_LOCALHOST_FOR_P2P,
|
||||
format("Use localhost P2P network for development (default: %s)", "false"))
|
||||
.withRequiredArg()
|
||||
|
@ -20,7 +20,6 @@ package bisq.network;
|
||||
public class NetworkOptionKeys {
|
||||
public static final String USE_LOCALHOST_FOR_P2P = "useLocalhostForP2P";
|
||||
public static final String MAX_CONNECTIONS = "maxConnections";
|
||||
public static final String PORT_KEY = "nodePort";
|
||||
public static final String NETWORK_ID = "networkId";
|
||||
//SOCKS_5_PROXY_BTC_ADDRESS used in network module so dont move it to BtcOptionKeys
|
||||
public static final String SOCKS_5_PROXY_BTC_ADDRESS = "socks5ProxyBtcAddress";
|
||||
|
@ -43,7 +43,7 @@ public class NetworkNodeProvider implements Provider<NetworkNode> {
|
||||
public NetworkNodeProvider(NetworkProtoResolver networkProtoResolver,
|
||||
BridgeAddressProvider bridgeAddressProvider,
|
||||
@Named(NetworkOptionKeys.USE_LOCALHOST_FOR_P2P) boolean useLocalhostForP2P,
|
||||
@Named(NetworkOptionKeys.PORT_KEY) int port,
|
||||
@Named(Config.NODE_PORT) int port,
|
||||
@Named(Config.TOR_DIR) File torDir,
|
||||
@Named(NetworkOptionKeys.TORRC_FILE) String torrcFile,
|
||||
@Named(NetworkOptionKeys.TORRC_OPTIONS) String torrcOptions,
|
||||
|
@ -50,6 +50,7 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static bisq.common.config.Config.BAN_LIST;
|
||||
import static bisq.common.config.Config.NODE_PORT;
|
||||
import static bisq.common.config.Config.TOR_DIR;
|
||||
import static com.google.inject.name.Names.named;
|
||||
|
||||
@ -85,9 +86,7 @@ public class P2PModule extends AppModule {
|
||||
|
||||
bind(File.class).annotatedWith(named(TOR_DIR)).toInstance(config.getTorDir());
|
||||
|
||||
// use a fixed port as arbitrator use that for his ID
|
||||
Integer port = environment.getProperty(NetworkOptionKeys.PORT_KEY, int.class, 9999);
|
||||
bind(int.class).annotatedWith(Names.named(NetworkOptionKeys.PORT_KEY)).toInstance(port);
|
||||
bind(int.class).annotatedWith(Names.named(NODE_PORT)).toInstance(config.getNodePort());
|
||||
|
||||
Integer maxConnections = environment.getProperty(NetworkOptionKeys.MAX_CONNECTIONS, int.class, P2PService.MAX_CONNECTIONS_DEFAULT);
|
||||
bind(int.class).annotatedWith(Names.named(NetworkOptionKeys.MAX_CONNECTIONS)).toInstance(maxConnections);
|
||||
|
Loading…
Reference in New Issue
Block a user