Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Allow any property to be overridden by the props file generated by th…
Browse files Browse the repository at this point in the history
…e CLI (#42)
  • Loading branch information
fieldju authored May 16, 2017
1 parent 5f535cf commit 082c2ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
# limitations under the License.
#

version=0.18.3
version=0.19.0
groupId=com.nike.cerberus
artifactId=cms
22 changes: 10 additions & 12 deletions src/main/java/com/nike/cerberus/server/config/CmsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.nike.cerberus.server.config;

import com.google.inject.util.Modules;
import com.nike.backstopper.handler.riposte.config.guice.BackstopperRiposteConfigGuiceModule;
import com.nike.cerberus.server.config.guice.*;
import com.nike.guice.PropertiesRegistrationGuiceModule;
Expand Down Expand Up @@ -85,9 +86,16 @@ protected CmsConfig(Config appConfig, PropertiesRegistrationGuiceModule properti
// Create a Guice Injector for this app.
List<Module> appGuiceModules = new ArrayList<>();
appGuiceModules.add(propertiesRegistrationGuiceModule);
appGuiceModules.addAll(getAppGuiceModules(appConfig));
appGuiceModules.addAll(Arrays.asList(
new CmsMyBatisModule(),
new BackstopperRiposteConfigGuiceModule(),
new CmsFlywayModule(),
new OneLoginGuiceModule()
));

Injector appInjector = Guice.createInjector(appGuiceModules);
// bind the CMS Guice module last allowing the S3 props file to override any given application property
Injector appInjector = Guice.createInjector(Modules.override(appGuiceModules)
.with(new CmsGuiceModule(appConfig, objectMapper)));

// Use the new Guice Injector to create a GuiceProvidedServerConfigValues, which will contain all the guice-provided config stuff for this app.
this.guiceValues = appInjector.getProvider(GuiceProvidedServerConfigValues.class).get();
Expand All @@ -101,16 +109,6 @@ public CmsConfig(Config appConfig) {
this(appConfig, new TypesafeConfigPropertiesRegistrationGuiceModule(appConfig));
}

protected List<Module> getAppGuiceModules(Config appConfig) {
return Arrays.asList(
new CmsGuiceModule(appConfig, objectMapper),
new CmsMyBatisModule(),
new BackstopperRiposteConfigGuiceModule(),
new CmsFlywayModule(),
new OneLoginGuiceModule()
);
}

public static ObjectMapper configureObjectMapper() {
final ObjectMapper om = new ObjectMapper();
om.findAndRegisterModules();
Expand Down

0 comments on commit 082c2ec

Please sign in to comment.