use HYDRA_DATA/hydra.conf as default location for hydra.conf

This commit is contained in:
Rob Vermaas 2011-03-07 15:06:32 +00:00
parent d4e9f5383b
commit 586f131ebd
3 changed files with 10 additions and 5 deletions

View file

@ -10,7 +10,7 @@ use Hydra::Helper::CatalystUtils;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( our @EXPORT = qw(
isValidPath isValidPath
getHydraPath getHydraDBPath openHydraDB txn_do getHydraPath getHydraDBPath openHydraDB getHydraConf txn_do
registerRoot getGCRootsDir gcRootFor registerRoot getGCRootsDir gcRootFor
getPrimaryBuildsForView getPrimaryBuildsForView
getPrimaryBuildTotal getPrimaryBuildTotal
@ -25,10 +25,16 @@ sub isValidPath {
sub getHydraPath { sub getHydraPath {
my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra"; my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra";
die "The HYDRA_DATA directory does not exist!\n" unless -d $dir; die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir;
return $dir; return $dir;
} }
sub getHydraConf {
my $conf = $ENV{"HYDRA_CONF"} || (getHydraPath . "/hydra.conf");
die "The HYDRA_CONF file ($conf) does not exist!\n" unless -f $conf;
return $conf;
}
sub getHydraDBPath { sub getHydraDBPath {
my $db = $ENV{"HYDRA_DBI"}; my $db = $ENV{"HYDRA_DBI"};

View file

@ -23,8 +23,7 @@ STDOUT->autoflush();
my $db = openHydraDB; my $db = openHydraDB;
my %config = new Config::General($ENV{"HYDRA_CONFIG"})->getall; my %config = new Config::General(getHydraConf)->getall;
sub sendTwitterNotification { sub sendTwitterNotification {
my ($build) = @_; my ($build) = @_;

View file

@ -18,7 +18,7 @@ use Data::Dump qw(dump);
STDOUT->autoflush(); STDOUT->autoflush();
my $db = openHydraDB; my $db = openHydraDB;
my %config = new Config::General($ENV{"HYDRA_CONFIG"})->getall; my %config = new Config::General(getHydraConf)->getall;
sub fetchInputs { sub fetchInputs {