mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #3432 from lusarz/refactor-bisq-environment-3
Refactor BisqEnvironment - create getListProperty
This commit is contained in:
commit
c1e7a0bb6c
@ -272,14 +272,9 @@ public class BisqEnvironment extends StandardEnvironment {
|
||||
try {
|
||||
propertySources.addLast(getAppDirProperties());
|
||||
|
||||
final String bannedPriceRelayNodesAsString = getProperty(FilterManager.BANNED_PRICE_RELAY_NODES, "");
|
||||
bannedPriceRelayNodes = !bannedPriceRelayNodesAsString.isEmpty() ? Arrays.asList(StringUtils.deleteWhitespace(bannedPriceRelayNodesAsString).split(",")) : null;
|
||||
|
||||
final String bannedSeedNodesAsString = getProperty(FilterManager.BANNED_SEED_NODES, "");
|
||||
bannedSeedNodes = !bannedSeedNodesAsString.isEmpty() ? Arrays.asList(StringUtils.deleteWhitespace(bannedSeedNodesAsString).split(",")) : new ArrayList<>();
|
||||
|
||||
final String bannedBtcNodesAsString = getProperty(FilterManager.BANNED_BTC_NODES, "");
|
||||
bannedBtcNodes = !bannedBtcNodesAsString.isEmpty() ? Arrays.asList(StringUtils.deleteWhitespace(bannedBtcNodesAsString).split(",")) : null;
|
||||
bannedPriceRelayNodes = getListProperty(FilterManager.BANNED_PRICE_RELAY_NODES, null);
|
||||
bannedSeedNodes = getListProperty(FilterManager.BANNED_SEED_NODES, new ArrayList<>());
|
||||
bannedBtcNodes = getListProperty(FilterManager.BANNED_BTC_NODES, null);
|
||||
|
||||
baseCurrencyNetwork = BaseCurrencyNetwork.valueOf(getProperty(BtcOptionKeys.BASE_CURRENCY_NETWORK,
|
||||
getDefaultBaseCurrencyNetwork().name()).toUpperCase());
|
||||
@ -371,6 +366,11 @@ public class BisqEnvironment extends StandardEnvironment {
|
||||
return properties.containsProperty(propertyKey) ? (String) properties.getProperty(propertyKey) : defaultValue;
|
||||
}
|
||||
|
||||
private List<String> getListProperty (String key, List defaultValue) {
|
||||
final String value = getProperty(key, "");
|
||||
return value.isEmpty() ? defaultValue : Arrays.asList(StringUtils.deleteWhitespace(value).split(","));
|
||||
}
|
||||
|
||||
private PropertySource<?> defaultProperties() {
|
||||
return new PropertiesPropertySource(BISQ_DEFAULT_PROPERTY_SOURCE_NAME, new Properties() {
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user