mirror of
https://github.com/derf/travelynx
synced 2024-12-03 01:39:10 +00:00
Use correct base URL when running a command job (work/maintenance)
This commit is contained in:
parent
170c7e420e
commit
6fc21cac41
2 changed files with 25 additions and 4 deletions
|
@ -5,6 +5,16 @@
|
|||
# 'localhost'.
|
||||
|
||||
{
|
||||
# Base URL of this travelynx installation, e.g. "https://travelynx.de" for
|
||||
# travelynx.de. Used to identify this travelynx instance when performing API
|
||||
# requests (so API providers know whom to contact case of issues) and for
|
||||
# imprint and other links in travelynx E-Mails. Note that this entry is
|
||||
# only used when travelynx is performing requests or sending E-mails from
|
||||
# a "work", "worker", or "maintenance" job. Otherwise, it will infer the
|
||||
# base URL from the HTTP request. If your travelynx instance is reachable
|
||||
# via multiple URLs, use any one of them.
|
||||
base_url => Mojo::URL->new('https://FIXME.local'),
|
||||
|
||||
# travelynx relies on several backend projects. You may override the
|
||||
# defaults to use other (e.g. self-hosted) instances.
|
||||
backend => {
|
||||
|
|
|
@ -276,6 +276,17 @@ sub startup {
|
|||
}
|
||||
);
|
||||
|
||||
$self->helper(
|
||||
base_url_for => sub {
|
||||
my ( $self, $path ) = @_;
|
||||
if ( ( my $url = $self->url_for($path) )->base ne q{} ) {
|
||||
return $url;
|
||||
}
|
||||
return $self->url_for($path)
|
||||
->base( $self->app->config->{base_url} );
|
||||
}
|
||||
);
|
||||
|
||||
$self->helper(
|
||||
hafas => sub {
|
||||
my ($self) = @_;
|
||||
|
@ -284,7 +295,7 @@ sub startup {
|
|||
hafas_rest_api => $self->app->config->{backend}{hafas_rest_api},
|
||||
main_cache => $self->app->cache_iris_main,
|
||||
realtime_cache => $self->app->cache_iris_rt,
|
||||
root_url => $self->url_for('/')->to_abs,
|
||||
root_url => $self->base_url_for('/')->to_abs,
|
||||
user_agent => $self->ua,
|
||||
version => $self->app->config->{version},
|
||||
);
|
||||
|
@ -298,7 +309,7 @@ sub startup {
|
|||
log => $self->app->log,
|
||||
main_cache => $self->app->cache_iris_main,
|
||||
realtime_cache => $self->app->cache_iris_rt,
|
||||
root_url => $self->url_for('/')->to_abs,
|
||||
root_url => $self->base_url_for('/')->to_abs,
|
||||
version => $self->app->config->{version},
|
||||
);
|
||||
}
|
||||
|
@ -317,7 +328,7 @@ sub startup {
|
|||
state $trwl_api = Travelynx::Helper::Traewelling->new(
|
||||
log => $self->app->log,
|
||||
model => $self->traewelling,
|
||||
root_url => $self->url_for('/')->to_abs,
|
||||
root_url => $self->base_url_for('/')->to_abs,
|
||||
user_agent => $self->ua,
|
||||
version => $self->app->config->{version},
|
||||
);
|
||||
|
@ -406,7 +417,7 @@ sub startup {
|
|||
state $dbdb = Travelynx::Helper::DBDB->new(
|
||||
log => $self->app->log,
|
||||
cache => $self->app->cache_iris_main,
|
||||
root_url => $self->url_for('/')->to_abs,
|
||||
root_url => $self->base_url_for('/')->to_abs,
|
||||
user_agent => $self->ua,
|
||||
version => $self->app->config->{version},
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue