aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/config')
-rw-r--r--src/main/java/org/traccar/config/Config.java12
-rw-r--r--src/main/java/org/traccar/config/Keys.java32
2 files changed, 43 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/config/Config.java b/src/main/java/org/traccar/config/Config.java
index 713f5c607..dd61e1f00 100644
--- a/src/main/java/org/traccar/config/Config.java
+++ b/src/main/java/org/traccar/config/Config.java
@@ -99,7 +99,17 @@ public class Config {
}
public int getInteger(ConfigKey<Integer> key) {
- return getInteger(key.getKey());
+ String value = getString(key.getKey());
+ if (value != null) {
+ return Integer.parseInt(value);
+ } else {
+ Integer defaultValue = key.getDefaultValue();
+ if (defaultValue != null) {
+ return defaultValue;
+ } else {
+ return 0;
+ }
+ }
}
@Deprecated
diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java
index ea3176afd..215b00805 100644
--- a/src/main/java/org/traccar/config/Keys.java
+++ b/src/main/java/org/traccar/config/Keys.java
@@ -20,6 +20,21 @@ import java.util.Collections;
public final class Keys {
/**
+ * Network interface for a the protocol. If not specified, server will bind all interfaces.
+ */
+ public static final ConfigSuffix<String> PROTOCOL_ADDRESS = new ConfigSuffix<>(
+ ".address",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
+ * Port number for the protocol. Most protocols use TCP on the transport layer. Some protocols use UDP. Some
+ * support both TCP and UDP.
+ */
+ public static final ConfigSuffix<Integer> PROTOCOL_PORT = new ConfigSuffix<>(
+ ".port",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
* Connection timeout value in seconds. Because sometimes there is no way to detect lost TCP connection old
* connections stay in open state. On most systems there is a limit on number of open connection, so this leads to
* problems with establishing new connections when number of devices is high or devices data connections are
@@ -193,6 +208,23 @@ public final class Keys {
600L);
/**
+ * Optional parameter to specify network interface for web interface to bind to. By default server will bind to all
+ * available interfaces.
+ */
+ public static final ConfigKey<String> WEB_ADDRESS = new ConfigKey<>(
+ "web.address",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
+ * Web interface TCP port number. By default Traccar uses port 8082. To avoid specifying port in the browser you
+ * can set it to 80 (default HTTP port).
+ */
+ public static final ConfigKey<Integer> WEB_PORT = new ConfigKey<>(
+ "web.port",
+ Collections.singletonList(KeyType.GLOBAL),
+ 8082);
+
+ /**
* WebSocket connection timeout in milliseconds. Default timeout is 10 minutes.
*/
public static final ConfigKey<Long> WEB_TIMEOUT = new ConfigKey<>(