From ea80a75204699df87215710513b749f1758a3206 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Nov 2015 11:03:05 +0100 Subject: [PATCH] Move getBaseUrl --- src/lib/Hydra/Helper/Email.pm | 12 ++++-------- src/lib/Hydra/Helper/Nix.pm | 9 ++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lib/Hydra/Helper/Email.pm b/src/lib/Hydra/Helper/Email.pm index e628fca3..44366f43 100644 --- a/src/lib/Hydra/Helper/Email.pm +++ b/src/lib/Hydra/Helper/Email.pm @@ -1,13 +1,14 @@ package Hydra::Helper::Email; use strict; -use Exporter 'import'; -use Email::Sender::Simple qw(sendmail); use Email::MIME; +use Email::Sender::Simple qw(sendmail); +use Exporter 'import'; use File::Slurp; +use Hydra::Helper::Nix; use Sys::Hostname::Long; -our @EXPORT = qw(sendEmail getBaseUrl); +our @EXPORT = qw(sendEmail); sub sendEmail { 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; diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index 1d1747c0..ca41d99b 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -9,10 +9,11 @@ use Hydra::Helper::CatalystUtils; use Hydra::Model::DB; use Nix::Store; use Encode; +use Sys::Hostname::Long; our @ISA = qw(Exporter); our @EXPORT = qw( - getHydraHome getHydraConfig txn_do + getHydraHome getHydraConfig getBaseUrl txn_do getSCMCacheDir registerRoot getGCRootsDir gcRootFor 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. # DBD::SQLite *has* a 30 second retry window, but apparently it # doesn't work.