From 413647661ac92feb38cafec3033cbc7bd07c5dc0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 30 Mar 2021 20:28:02 +0200 Subject: allow hafas-rest-api endpoint to be configured This allows selfhosted installations to be used --- lib/DBInfoscreen.pm | 3 +++ lib/DBInfoscreen/Helper/HAFAS.pm | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 7a0bea4..b9b850d 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -30,6 +30,8 @@ sub startup { my ($self) = @_; $self->config( + hafas_rest_api => $ENV{DBFAKEDISPLAY_HAFAS_API} + // 'https://v5.db.transport.rest', hypnotoad => { accepts => $ENV{DBFAKEDISPLAY_ACCEPTS} // 100, clients => $ENV{DBFAKEDISPLAY_CLIENTS} // 10, @@ -142,6 +144,7 @@ sub startup { hafas => sub { my ($self) = @_; state $hafas = DBInfoscreen::Helper::HAFAS->new( + api => $self->config->{hafas_rest_api}, log => $self->app->log, main_cache => $self->app->cache_iris_main, realtime_cache => $self->app->cache_iris_rt, diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index 8c11412..a421c38 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -379,8 +379,8 @@ sub get_route_timestamps_p { sub get_polyline_p { my ( $self, $trip_id, $line ) = @_; - my $url - = "https://v5.db.transport.rest/trips/${trip_id}?lineName=${line}&polyline=true"; + my $api = $self->{api}; + my $url = "${api}/trips/${trip_id}?lineName=${line}&polyline=true"; my $cache = $self->{realtime_cache}; my $promise = Mojo::Promise->new; -- cgit v1.2.3