Skip to content

Commit

Permalink
Let Heroku decide which http port to use
Browse files Browse the repository at this point in the history
  • Loading branch information
luccioman committed Jul 6, 2016
1 parent 66fea8a commit b57a06d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Procfile
@@ -1 +1 @@
web: java $JAVA_OPTS -classpath target/classes:lib/* net.yacy.yacy
web: java $JAVA_OPTS -Dhttp.port=$PORT -classpath target/classes:lib/* net.yacy.yacy
9 changes: 9 additions & 0 deletions source/net/yacy/server/serverSwitch.java
Expand Up @@ -229,6 +229,15 @@ public int getPublicPort(final String key, final int dflt) {
*/
public int getLocalPort() {

/* A system property "http.port" may override configuration
* This is useful when running YaCy inside a container manager such as Heroku which decide which http port to use */
String systemDefinedPort = System.getProperty("http.port");
if(systemDefinedPort != null) {
try {
return Integer.parseInt(systemDefinedPort);
} catch(NumberFormatException e) {
}
}
return getConfigInt("port", 8090);
}

Expand Down

0 comments on commit b57a06d

Please sign in to comment.