diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2013-09-22 20:25:21 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2013-09-22 20:25:21 -0700 |
commit | f2bd99c91b3d615c9fea4f9195fe1a888a2d93e8 (patch) | |
tree | 94713c5fbf5d4270af4b25518ec83e9de0766bc2 /src/com/p4square/grow/backend | |
parent | e18831fb897c7b9ea7bf7045ebaaf00f94e01acc (diff) |
Fixing tomcat config overrides.20130922b
Finally fixing config overrides. Found a bug? in restlet where the
Servlet context parameters aren't passed to the final application. I'm
working around the issue by creating my own component which builds the
config and shares it with the frontend and backend. Overall I think it's
a much more elegant solution.
Now we have the ability to specify an external config file for the F1
credentials and the ability configure different domains in different
tomcat containers.
Diffstat (limited to 'src/com/p4square/grow/backend')
-rw-r--r-- | src/com/p4square/grow/backend/GrowBackend.java | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/com/p4square/grow/backend/GrowBackend.java b/src/com/p4square/grow/backend/GrowBackend.java index 09c1d84..7da6fff 100644 --- a/src/com/p4square/grow/backend/GrowBackend.java +++ b/src/com/p4square/grow/backend/GrowBackend.java @@ -34,7 +34,11 @@ public class GrowBackend extends Application { private final CassandraDatabase mDatabase; public GrowBackend() { - mConfig = new Config(); + this(new Config()); + } + + public GrowBackend(Config config) { + mConfig = config; mDatabase = new CassandraDatabase(); } @@ -71,23 +75,6 @@ public class GrowBackend extends Application { public void start() throws Exception { super.start(); - // Load config - final String configDomain = - getContext().getParameters().getFirstValue("configDomain"); - if (configDomain != null) { - mConfig.setDomain(configDomain); - } - - mConfig.updateConfig(this.getClass().getResourceAsStream("/grow.properties")); - - final String configFilename = - getContext().getParameters().getFirstValue("configFile"); - - if (configFilename != null) { - LOG.info("Loading configuration from " + configFilename); - mConfig.updateConfig(configFilename); - } - // Setup database mDatabase.setClusterName(mConfig.getString("clusterName", "Dev Cluster")); mDatabase.setKeyspaceName(mConfig.getString("keyspace", "GROW")); |