diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/Context.java | 8 | ||||
-rw-r--r-- | src/org/traccar/notification/NotificationFormatter.java | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index ef515ad2f..62396d740 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -17,6 +17,7 @@ package org.traccar; import com.ning.http.client.AsyncHttpClient; +import java.net.InetAddress; import java.util.Properties; import org.apache.velocity.app.VelocityEngine; @@ -256,6 +257,13 @@ public final class Context { Context.getConfig().getString("mail.templatesPath", "templates/mail") + "/"); velocityProperties.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute"); + + String address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress()); + String port = config.getString("web.port", "8082"); + String webUrl = "http://" + address + ":" + port + "/"; + webUrl = Context.getConfig().getString("web.url", webUrl); + velocityProperties.setProperty("web.url", webUrl); + velocityEngine = new VelocityEngine(); velocityEngine.init(velocityProperties); } diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index 2d580922c..819c387d1 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -45,6 +45,7 @@ public final class NotificationFormatter { if (event.getGeofenceId() != 0) { velocityContext.put("geofence", Context.getGeofenceManager().getGeofence(event.getGeofenceId())); } + velocityContext.put("webUrl", Context.getVelocityEngine().getProperty("web.url")); Template template = null; try { |