more flexibility

This commit is contained in:
rusefi 2020-07-25 01:01:08 -04:00
parent 01b9272867
commit 425149f0a8
4 changed files with 11 additions and 4 deletions

View File

@ -19,7 +19,7 @@ import static com.devexperts.logging.Logging.getLogging;
public class LocalApplicationProxy {
private static final Logging log = getLogging(LocalApplicationProxy.class);
public static final int SERVER_PORT_FOR_APPLICATIONS = 8002;
public static final int SERVER_PORT_FOR_APPLICATIONS = HttpUtil.getIntProperty("applications.port", 8002);
private final ApplicationRequest applicationRequest;
public LocalApplicationProxy(ApplicationRequest applicationRequest) {

View File

@ -1,7 +1,6 @@
package com.rusefi.tools.online;
import com.devexperts.logging.Logging;
import com.opensr5.Logger;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@ -23,7 +22,8 @@ public class HttpUtil {
// todo: migrate proxy http json API server to TLS
public static final String RUSEFI_PROXY_JSON_PROTOCOL = "http://";
public static final int PROXY_JSON_API_HTTP_PORT = Integer.parseInt(System.getProperty("http.port", "8001"));
public static final int PROXY_JSON_API_HTTP_PORT = getIntProperty("http.port", 8001);
/**
* hostname of PROXY server, not primary rusEFI web server - those are two separate hosts at the moment
*/
@ -74,4 +74,8 @@ public class HttpUtil {
}
return jsonObject;
}
public static int getIntProperty(String propertyName, int defaultValue) {
return Integer.parseInt(System.getProperty(propertyName, Integer.toString(defaultValue)));
}
}

View File

@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicLong;
import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.Timeouts.SECOND;
import static com.rusefi.tools.online.HttpUtil.getIntProperty;
/**
* See NetworkConnectorStartup - NetworkConnector connects an ECU to this backend
@ -49,7 +50,7 @@ public class Backend implements Closeable {
* @see HttpUtil#PROXY_JSON_API_HTTP_PORT
* @see LocalApplicationProxy#SERVER_PORT_FOR_APPLICATIONS
*/
public static final int SERVER_PORT_FOR_CONTROLLERS = 8003;
public static final int SERVER_PORT_FOR_CONTROLLERS = getIntProperty("controllers.port", 8003);
private static final String MAX_PACKET_GAP = "MAX_PACKET_GAP";
/**

View File

@ -1 +1,3 @@
#!/bin/sh
mkdir log
./run_server.sh > log/proxy.stdout 2>log/proxy.stderr &