Skip to content

Commit

Permalink
Merge pull request #245 from brharrington/admin-config
Browse files Browse the repository at this point in the history
hook AdminConfig interface to properties
  • Loading branch information
brharrington committed Apr 21, 2016
2 parents 2e1b79b + c5094c7 commit 41367f3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.netflix.archaius.config.polling.PollingResponse;
import com.netflix.archaius.guice.ArchaiusModule;
import com.netflix.archaius.typesafe.TypesafeConfig;
import com.netflix.iep.admin.AdminConfig;
import com.netflix.iep.admin.AdminModule;
import com.netflix.spectator.api.DefaultRegistry;
import com.netflix.spectator.api.Registry;
Expand All @@ -33,6 +34,7 @@
import javax.inject.Singleton;
import java.net.URI;
import java.net.URL;
import java.time.Duration;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -72,6 +74,30 @@ private com.netflix.archaius.api.Config providesAppConfig(final Config applicati
return new TypesafeConfig(application);
}

@Provides
@Singleton
private AdminConfig providesAdminConfig(Config cfg) {
return new AdminConfig() {
@Override public int port() {
return cfg.getInt("netflix.iep.admin.port");
}

@Override public int backlog() {
return cfg.getInt("netflix.iep.admin.backlog");
}

@Override public Duration shutdownDelay() {
long nanos = cfg.getDuration("netflix.iep.admin.shutdown-delay", TimeUnit.NANOSECONDS);
return Duration.ofNanos(nanos);
}

@Override public String uiLocation() {
final String k = "netflix.iep.admin.ui-location";
return cfg.hasPath(k) ? cfg.getString(k) : "/ui";
}
};
}

@Override public boolean equals(Object obj) {
return obj != null && getClass().equals(obj.getClass());
}
Expand Down
5 changes: 5 additions & 0 deletions iep-platformservice/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ netflix.iep.archaius {
polling-interval = 30s
}

netflix.iep.admin {
port = 8077
backlog = 10
shutdown-delay = 0s
}

0 comments on commit 41367f3

Please sign in to comment.