You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/07/24 00:56:21 UTC
svn commit: r967295 - in /shindig/trunk: config/
java/common/src/main/java/org/apache/shindig/common/
java/common/src/main/java/org/apache/shindig/config/
java/social-api/src/test/java/org/apache/shindig/social/
Author: lindner
Date: Fri Jul 23 22:56:21 2010
New Revision: 967295
URL: http://svn.apache.org/viewvc?rev=967295&view=rev
Log:
add shindig.host property variable
Modified:
shindig/trunk/config/container.js
shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
shindig/trunk/java/common/src/main/java/org/apache/shindig/config/JsonContainerConfig.java
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java
Modified: shindig/trunk/config/container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/config/container.js?rev=967295&r1=967294&r2=967295&view=diff
==============================================================================
--- shindig/trunk/config/container.js (original)
+++ shindig/trunk/config/container.js Fri Jul 23 22:56:21 2010
@@ -102,10 +102,10 @@
//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
// URI for the default shindig test instance.
-"defaultShindigTestHost": "http://localhost:${SERVER_PORT}",
+"defaultShindigTestHost": "http://${SERVER_HOST}:${SERVER_PORT}",
// Authority (host:port without scheme) for the proxy and concat servlets.
-"defaultShindigProxyConcatAuthority": "localhost:${SERVER_PORT}",
+"defaultShindigProxyConcatAuthority": "${SERVER_HOST}:${SERVER_PORT}",
// Default Uri config: these must be overridden - specified here for testing purposes
"gadgets.uri.iframe.unlockedDomain": "${Cur['defaultShindigTestHost']}",
Modified: shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java?rev=967295&r1=967294&r2=967295&view=diff
==============================================================================
--- shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java (original)
+++ shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java Fri Jul 23 22:56:21 2010
@@ -59,6 +59,7 @@ public class PropertiesModule extends Ab
Names.bindProperties(this.binder(), getProperties());
// This could be generalized to inject any system property...
this.binder().bindConstant().annotatedWith(Names.named("shindig.port")).to(getServerPort());
+ this.binder().bindConstant().annotatedWith(Names.named("shindig.host")).to(getServerHostname());
}
/**
@@ -72,6 +73,18 @@ public class PropertiesModule extends Ab
"8080";
}
+ /*
+ * Should return the hostname that the current server is running on. Useful for testing and working out of the box configs.
+ * Looks for a hostname in system properties "shindig.host", if not set uses fixed value of "localhost"
+ * @return a hostname
+ */
+
+ protected String getServerHostname() {
+ return System.getProperty("shindig.host") != null ? System.getProperty("shindig.host") :
+ return System.getProperty("jetty.host") != null ? System.getProperty("jetty.host") :
+ "localhost";
+ }
+
protected static String getDefaultPropertiesPath() {
return DEFAULT_PROPERTIES;
}
Modified: shindig/trunk/java/common/src/main/java/org/apache/shindig/config/JsonContainerConfig.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/config/JsonContainerConfig.java?rev=967295&r1=967294&r2=967295&view=diff
==============================================================================
--- shindig/trunk/java/common/src/main/java/org/apache/shindig/config/JsonContainerConfig.java (original)
+++ shindig/trunk/java/common/src/main/java/org/apache/shindig/config/JsonContainerConfig.java Fri Jul 23 22:56:21 2010
@@ -80,7 +80,7 @@ public class JsonContainerConfig extends
// Used by tests
public JsonContainerConfig(String containers, Expressions expressions) throws ContainerConfigException {
- this(containers, "8080", expressions);
+ this(containers, "localhost", "8080", expressions);
}
/**
* Creates a new configuration from files.
@@ -88,6 +88,7 @@ public class JsonContainerConfig extends
*/
@Inject
public JsonContainerConfig(@Named("shindig.containers.default") String containers,
+ @Nullable @Named("shindig.host") String host,
@Nullable @Named("shindig.port") String port,
Expressions expressions)
throws ContainerConfigException {
@@ -95,6 +96,7 @@ public class JsonContainerConfig extends
JSONObject configJson = loadContainers(containers);
try {
configJson.getJSONObject(ContainerConfig.DEFAULT_CONTAINER).put("SERVER_PORT", port);
+ configJson.getJSONObject(ContainerConfig.DEFAULT_CONTAINER).put("SERVER_HOST", host);
} catch (JSONException e) {
// ignore
}
Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java?rev=967295&r1=967294&r2=967295&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/SocialApiTestsGuiceModule.java Fri Jul 23 22:56:21 2010
@@ -76,6 +76,7 @@ public class SocialApiTestsGuiceModule e
bindConstant().annotatedWith(Names.named("shindig.containers.default"))
.to("res://containers/default/container.js");
bindConstant().annotatedWith(Names.named("shindig.port")).to("8080");
+ bindConstant().annotatedWith(Names.named("shindig.host")).to("localhost");
bind(ContainerConfig.class).to(JsonContainerConfig.class);
bind(Integer.class).annotatedWith(