Skip to content

Commit

Permalink
Migrate default ports to code
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Apr 18, 2024
1 parent dc6f5d9 commit 93c4e0e
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 292 deletions.
4 changes: 0 additions & 4 deletions debug.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

<entry key='config.default'>./setup/default.xml</entry>

<entry key='web.path'>./traccar-web/simple</entry>
<entry key='web.debug'>true</entry>
<entry key='web.console'>true</entry>
Expand Down
271 changes: 0 additions & 271 deletions setup/default.xml

This file was deleted.

16 changes: 1 addition & 15 deletions setup/traccar.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

<entry key='config.default'>./conf/default.xml</entry>

<!--
This is the main configuration file. All your configuration parameters should be placed in this file.
Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
remove "config.default" parameter from this file unless you know what you are doing.
For list of available parameters see following page: https://www.traccar.org/configuration-file/
-->
<!-- Documentation: https://www.traccar.org/configuration-file/ -->

<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./data/database</entry>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/traccar/ServerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ServerManager(
for (Class<?> protocolClass : ClassScanner.findSubclasses(BaseProtocol.class, "org.traccar.protocol")) {
String protocolName = BaseProtocol.nameFromClass(protocolClass);
if (enabledProtocols == null || enabledProtocols.contains(protocolName)) {
if (config.hasKey(Keys.PROTOCOL_PORT.withPrefix(protocolName))) {
if (config.getInteger(Keys.PROTOCOL_PORT.withPrefix(protocolName)) > 0) {
BaseProtocol protocol = (BaseProtocol) injector.getInstance(protocolClass);
connectorList.addAll(protocol.getConnectorList());
protocolList.put(protocol.getName(), protocol);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/traccar/config/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private Keys() {
* 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 IntegerConfigSuffix(
public static final ConfigSuffix<Integer> PROTOCOL_PORT = new PortConfigSuffix(
".port",
List.of(KeyType.CONFIG));

Expand Down
Loading

0 comments on commit 93c4e0e

Please sign in to comment.