Skip to content

Commit b63a85f

Browse files
author
Per Liedman
committed
Add warning about the demo server
1 parent 510d74f commit b63a85f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/L.Routing.OSRMv1.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,30 @@
2626
steps: true
2727
},
2828
polylinePrecision: 5,
29-
useHints: true
29+
useHints: true,
30+
suppressDemoServerWarning: false
3031
},
3132

3233
initialize: function(options) {
3334
L.Util.setOptions(this, options);
3435
this._hints = {
3536
locations: {}
3637
};
38+
39+
if (!this.options.suppressDemoServerWarning &&
40+
this.options.serviceUrl.indexOf('//router.project-osrm.org') >= 0) {
41+
console.warn('You are using OSRM\'s demo server. ' +
42+
'Please note that it is **NOT SUITABLE FOR PRODUCTION USE**.\n' +
43+
'Refer to the demo server\'s usage policy: ' +
44+
'https://github.com/Project-OSRM/osrm-backend/wiki/Api-usage-policy\n\n' +
45+
'To change, set the serviceUrl option.\n\n' +
46+
'Please do not report issues with this server to neither ' +
47+
'Leaflet Routing Machine or OSRM - it\'s for\n' +
48+
'demo only, and will sometimes not be available, or work in ' +
49+
'unexpected ways.\n\n' +
50+
'Please set up your own OSRM server, or use a paid service ' +
51+
'provider for production.');
52+
}
3753
},
3854

3955
route: function(waypoints, callback, context, options) {

0 commit comments

Comments
 (0)