[gnome-maps/wip/mlundblad/override-transit-plugin: 5/5] openTripPlanner: Add support for debug env variables
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/override-transit-plugin: 5/5] openTripPlanner: Add support for debug env variables
- Date: Mon, 11 Jan 2021 21:16:30 +0000 (UTC)
commit 7b3e8a02941f48cfc7cae31fd5cce6d9d386617b
Author: Marcus Lundblad <ml update uu se>
Date: Mon Jan 11 22:15:04 2021 +0100
openTripPlanner: Add support for debug env variables
Add support for OTP_BASE_URL and OTP_ONLY_TRANSIT_DATA
to override parameters for the plugin.
src/transitplugins/openTripPlanner.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index b0910bf4..371beec9 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -113,13 +113,19 @@ const GAP_BEFORE_MORE_RESULTS = 120;
var OpenTripPlanner = class OpenTripPlanner {
constructor(params) {
+ let baseUrl = GLib.getenv('OTP_BASE_URL') ?? params.baseUrl;
+ let onlyTransitDataEnv = GLib.getenv('OTP_ONLY_TRANSIT_DATA');
+ let onlyTransitData =
+ onlyTransitDataEnv ? onlyTransitDataEnv === 'true' :
+ params.onlyTransitData ?? false;
+
this._session = new Soup.Session({ user_agent : 'gnome-maps/' + pkg.version });
this._plan = Application.routingDelegator.transitRouter.plan;
this._query = Application.routeQuery;
- this._baseUrl = params.baseUrl;
+ this._baseUrl = baseUrl;
this._router = params.router || 'default';
this._routerUrl = params.routerUrl || null;
- this._onlyTransitData = params.onlyTransitData || false;
+ this._onlyTransitData = onlyTransitData;
this._extendPrevious = false;
this._language = Utils.getLanguage();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]