Skip to content

Commit

Permalink
Sync with updates to ConfigModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
bpitman committed Nov 20, 2015
1 parent c9acbf3 commit b659355
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public DynamicNoOpConfigModule(String[] propFiles) {
install(m);
}

@Override public boolean equals(Object obj) {
return obj != null && getClass().equals(obj.getClass());
}

@Override public int hashCode() {
return getClass().hashCode();
}

private static class OverrideModule extends AbstractModule {

private final String[] propFiles;
Expand All @@ -65,10 +73,18 @@ private static class OverrideModule extends AbstractModule {
}

@Override protected void configure() {
bind(Config.class).toInstance(ConfigFactory.load());
//bind(Config.class).toInstance(ConfigFactory.load());
bind(DynamicPropertiesConfiguration.class).asEagerSingleton();
}

@Provides
@Singleton
Config providesTypesafeConfig() {
final Config baseConfig = ConfigFactory.load();
final String envConfigName = "iep-" + baseConfig.getString("netflix.iep.env.account-type");
return ConfigFactory.load(envConfigName).withFallback(baseConfig);
}

@Provides
@Singleton
@RemoteLayer
Expand All @@ -87,7 +103,7 @@ public PollingResponse call() {
@Provides
@Singleton
@ApplicationLayer
protected CompositeConfig providesAppConfig(Config cfg) throws Exception {
private CompositeConfig providesAppConfig(Config cfg) throws Exception {
final Properties props = (propFiles == null)
? ScopedPropertiesLoader.load()
: ScopedPropertiesLoader.load(propFiles);
Expand Down

0 comments on commit b659355

Please sign in to comment.