[gnome-maps/wip/mlundblad/override-transit-plugin] 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] openTripPlanner: Add support for debug env variables
- Date: Tue, 12 Jan 2021 21:26:51 +0000 (UTC)
commit c11f846322365958e0f90b70fe7e16b76d4a0a1b
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 | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index b0910bf4..7326225f 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -113,13 +113,18 @@ const GAP_BEFORE_MORE_RESULTS = 120;
var OpenTripPlanner = class OpenTripPlanner {
constructor(params) {
+ 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._router = params.router || 'default';
- this._routerUrl = params.routerUrl || null;
- this._onlyTransitData = params.onlyTransitData || false;
+ this._baseUrl = GLib.getenv('OTP_BASE_URL') ?? params.baseUrl;
+ this._router = params?.router ?? 'default';
+ this._routerUrl = params?.routerUrl;
+ this._onlyTransitData = onlyTransitData;
this._extendPrevious = false;
this._language = Utils.getLanguage();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]