diff options
author | Rafael E. Ajuria <reajuria@users.noreply.github.com> | 2023-06-10 14:01:11 +0000 |
---|---|---|
committer | Rafael E. Ajuria <reajuria@users.noreply.github.com> | 2023-06-10 14:01:11 +0000 |
commit | dc22bc5feef7887d3baec1b2904fc18e1d067378 (patch) | |
tree | b63378c84dcf5c6098fad97437b91dc767922107 | |
parent | a39af3b4d72f3ed8a6dfe868d365d6bbf34e18d3 (diff) | |
download | trackermap-server-dc22bc5feef7887d3baec1b2904fc18e1d067378.tar.gz trackermap-server-dc22bc5feef7887d3baec1b2904fc18e1d067378.tar.bz2 trackermap-server-dc22bc5feef7887d3baec1b2904fc18e1d067378.zip |
cleanup broadcast type
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 17 | ||||
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 950a7278a..b7bdbc6bf 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -341,14 +341,17 @@ public class MainModule extends AbstractModule { @Provides public static BroadcastService provideBroadcastService( Config config, ObjectMapper objectMapper) throws IOException { - switch (config.getString(Keys.BROADCAST_TYPE)) { - case "multicast": - return new MulticastBroadcastService(config, objectMapper); - case "redis": - return new RedisBroadcastService(config, objectMapper); - default: - return new NullBroadcastService(); + if (config.hasKey(Keys.BROADCAST_TYPE)) { + switch (config.getString(Keys.BROADCAST_TYPE)) { + case "multicast": + return new MulticastBroadcastService(config, objectMapper); + case "redis": + return new RedisBroadcastService(config, objectMapper); + default: + break; + } } + return new NullBroadcastService(); } @Singleton diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 78e081ce5..1ff1d1b51 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -1761,8 +1761,7 @@ public final class Keys { */ public static final ConfigKey<String> BROADCAST_TYPE = new StringConfigKey( "broadcast.type", - List.of(KeyType.CONFIG), - ""); + List.of(KeyType.CONFIG)); /** * Multicast interface. It can be either an IP address or an interface name. |