Skip to content

Commit

Permalink
Merge pull request #31 from ghubstan/remove-program-args-param-from-ctor
Browse files Browse the repository at this point in the history
Remove String[] args from network service class constructors
  • Loading branch information
chimp1984 authored Jan 4, 2022
2 parents 22bf312 + d18a3d4 commit 92cb549
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public DefaultServiceProvider(ApplicationOptions applicationOptions, String[] ar
keyPairService = new KeyPairService(keyPairRepositoryConf);

NetworkService.Config networkServiceConfig = NetworkServiceConfigFactory.getConfig(applicationOptions.baseDir(),
getConfig("misq.networkServiceConfig"), args);
getConfig("misq.networkServiceConfig"));
networkService = new NetworkService(networkServiceConfig, keyPairService);

identityService = new IdentityService(networkService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public class NetworkNodeServiceProvider extends ServiceProvider {
private final NetworkService networkService;
private final ApplicationOptions applicationOptions;

public NetworkNodeServiceProvider(ApplicationOptions applicationOptions, String[] args) {
public NetworkNodeServiceProvider(ApplicationOptions applicationOptions) {
super("Seed");
this.applicationOptions = applicationOptions;

KeyPairService.Conf keyPairRepositoryConf = KeyPairRepositoryConfigFactory.getConfig(applicationOptions.baseDir());
keyPairService = new KeyPairService(keyPairRepositoryConf);

NetworkService.Config networkServiceConfig = NetworkServiceConfigFactory.getConfig(applicationOptions.baseDir(),
getConfig("misq.networkServiceConfig"), args);
getConfig("misq.networkServiceConfig"));
networkService = new NetworkService(networkServiceConfig, keyPairService);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,8 @@
*/
@Slf4j
public class NetworkServiceConfigFactory {
public static NetworkService.Config getConfig(String baseDir, Config typesafeConfig) {
return getConfig(baseDir, typesafeConfig, Optional.empty());
}

public static NetworkService.Config getConfig(String baseDir, Config typesafeConfig, String[] args) {
return getConfig(baseDir, typesafeConfig, Optional.of(args));
}

private static NetworkService.Config getConfig(String baseDir, Config typesafeConfig, Optional<String[]> args) {
public static NetworkService.Config getConfig(String baseDir, Config typesafeConfig) {
// Set<Transport.Type> supportedTransportTypes = Set.of(Transport.Type.CLEAR, Transport.Type.TOR, Transport.Type.I2P);
Set<Transport.Type> supportedTransportTypes = Set.of(Transport.Type.CLEAR, Transport.Type.TOR);
// Set<Transport.Type> supportedTransportTypes = Set.of(Transport.Type.CLEAR);
Expand Down

0 comments on commit 92cb549

Please sign in to comment.