Let Heroku decide which http port to use

This commit is contained in:
luccioman 2016-07-06 22:14:40 +02:00
parent 66fea8add1
commit b57a06d88e
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -229,6 +229,15 @@ public class serverSwitch {
*/
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);
}