Skip to content

Commit

Permalink
[closes #437] Add defaultConfiguration method to customizable service
Browse files Browse the repository at this point in the history
  • Loading branch information
avano authored and mmuzikar committed Apr 20, 2023
1 parent 3f6da83 commit 8cf375b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ public ConfigurableService() {
public C getConfiguration() {
return configuration;
}

/**
* The default configuration in case no customizations are made.
*/
protected abstract void defaultConfiguration();
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static <S extends Service> S create(Class<S> clazz) {

public static <C extends ServiceConfiguration, S extends ConfigurableService<C>> S create(Class<S> clazz, Consumer<C> config) {
S service = create(clazz);
service.defaultConfiguration();
config.accept(service.getConfiguration());
return service;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public abstract class AWSService<A extends AWSAccount, C extends SdkClient, V ex
protected C client;
protected V validation;

public AWSService() {
@Override
protected void defaultConfiguration() {
getConfiguration().useLocalstack(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public abstract class Jaeger extends ConfigurableService<JaegerConfiguration> im

protected JaegerValidation validation;

@Override
protected void defaultConfiguration() {
}

protected Map<String, String> env() {
Map<String, String> env = new HashMap<>();
env.put("COLLECTOR_OTLP_ENABLED", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class LocalSplunk extends Splunk implements Deployable {
private final int containerApiPort = 8089;
private static final String PASSWORD = "password";

public LocalSplunk() {
@Override
public void defaultConfiguration() {
getConfiguration().protocol(SplunkProtocol.HTTP);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class OpenshiftSplunk extends Splunk implements OpenshiftDeployable {
private Route apiRoute;
private String sccName;

public OpenshiftSplunk() {
@Override
public void defaultConfiguration() {
getConfiguration().protocol(SplunkProtocol.HTTPS);
}

Expand Down

0 comments on commit 8cf375b

Please sign in to comment.