Move getBaseUrl

This commit is contained in:
Eelco Dolstra 2015-11-17 11:03:05 +01:00
parent dddb9a281d
commit ea80a75204
2 changed files with 12 additions and 9 deletions

View file

@ -1,13 +1,14 @@
package Hydra::Helper::Email; package Hydra::Helper::Email;
use strict; use strict;
use Exporter 'import';
use Email::Sender::Simple qw(sendmail);
use Email::MIME; use Email::MIME;
use Email::Sender::Simple qw(sendmail);
use Exporter 'import';
use File::Slurp; use File::Slurp;
use Hydra::Helper::Nix;
use Sys::Hostname::Long; use Sys::Hostname::Long;
our @EXPORT = qw(sendEmail getBaseUrl); our @EXPORT = qw(sendEmail);
sub sendEmail { sub sendEmail {
my ($config, $to, $subject, $body, $extraHeaders) = @_; my ($config, $to, $subject, $body, $extraHeaders) = @_;
@ -41,9 +42,4 @@ sub sendEmail {
} }
} }
sub getBaseUrl {
my ($config) = @_;
return $config->{'base_uri'} // "http://" . hostname_long . ":3000";
}
1; 1;

View file

@ -9,10 +9,11 @@ use Hydra::Helper::CatalystUtils;
use Hydra::Model::DB; use Hydra::Model::DB;
use Nix::Store; use Nix::Store;
use Encode; use Encode;
use Sys::Hostname::Long;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( our @EXPORT = qw(
getHydraHome getHydraConfig txn_do getHydraHome getHydraConfig getBaseUrl txn_do
getSCMCacheDir getSCMCacheDir
registerRoot getGCRootsDir gcRootFor registerRoot getGCRootsDir gcRootFor
jobsetOverview jobsetOverview_ jobsetOverview jobsetOverview_
@ -39,6 +40,12 @@ sub getHydraConfig {
} }
sub getBaseUrl {
my ($config) = @_;
return $config->{'base_uri'} // "http://" . hostname_long . ":3000";
}
# Awful hack to handle timeouts in SQLite: just retry the transaction. # Awful hack to handle timeouts in SQLite: just retry the transaction.
# DBD::SQLite *has* a 30 second retry window, but apparently it # DBD::SQLite *has* a 30 second retry window, but apparently it
# doesn't work. # doesn't work.