aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-11-09 11:55:05 -0800
committerGitHub <noreply@github.com>2019-11-09 11:55:05 -0800
commit2f139fccea33ae2471969af9f0f71a8b9853e560 (patch)
tree4045fbc231ae95218b149dcb8710de0f57700a41 /src
parent89ad80238cccb24f53e9b8badd2e2471937e7ed0 (diff)
parent7938cf6c2d821517eaa0ceb3790651b0d290769c (diff)
downloadtrackermap-server-2f139fccea33ae2471969af9f0f71a8b9853e560.tar.gz
trackermap-server-2f139fccea33ae2471969af9f0f71a8b9853e560.tar.bz2
trackermap-server-2f139fccea33ae2471969af9f0f71a8b9853e560.zip
Merge pull request #4435 from neuharthr/master
Allow users to set the OpenCellID URL via the config file
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/MainModule.java2
-rw-r--r--src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java7
2 files changed, 3 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 3acd19b6a..9adea61b0 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -191,7 +191,7 @@ public class MainModule extends AbstractModule {
case "google":
return new GoogleGeolocationProvider(key);
case "opencellid":
- return new OpenCellIdGeolocationProvider(key);
+ return new OpenCellIdGeolocationProvider(url, key);
case "unwired":
return new UnwiredGeolocationProvider(url, key);
default:
diff --git a/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java b/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
index 768aaf6a2..88353391d 100644
--- a/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
+++ b/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
@@ -26,12 +26,9 @@ public class OpenCellIdGeolocationProvider implements GeolocationProvider {
private String url;
- public OpenCellIdGeolocationProvider(String key) {
- this("http://opencellid.org/cell/get", key);
- }
-
public OpenCellIdGeolocationProvider(String url, String key) {
- this.url = url + "?format=json&mcc=%d&mnc=%d&lac=%d&cellid=%d&key=" + key;
+ this.url = (url == null ? "http://opencellid.org/cell/get" : url)
+ + "?format=json&mcc=%d&mnc=%d&lac=%d&cellid=%d&key=" + key;
}
@Override