Skip to content

Commit

Permalink
More changes to enable skip_db feature, originally by Richard Templet
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjensen committed Jun 24, 2011
1 parent e1bd2f3 commit 33053c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Camp/Master.pm
Expand Up @@ -757,6 +757,7 @@ sub substitute_hash_tokens {

sub _config_hash_db {
my ($hash, $camp_number) = @_;
return if $hash->{skip_db};
_determine_db_type_and_path( $hash ) or die "Failed to determine database type!\n";
$hash->{db_host} = 'localhost';
$hash->{db_port} = 8900 + $camp_number;
Expand All @@ -774,6 +775,9 @@ sub _config_hash_db {
$hash->{db_conf} = File::Spec->catfile( $hash->{path}, 'my.cnf', );
$hash->{db_socket} = File::Spec->catfile( $hash->{db_tmpdir}, "mysql.$camp_number.sock" );
}
elsif ($hash->{db_type} eq 'none') {
# do nothing
}
else {
die "Unknown database type!\n";
}
Expand All @@ -789,10 +793,9 @@ sub _determine_db_type_and_path {
);

my @found = grep { -d File::Spec->catfile( type_path(), $_ ) } keys %paths;
return $conf->{db_type} = 'none' if !@found;
die "Found more than one database type; only one may be used!\n"
if @found > 1;
die "No database found for camp type!\n"
if !@found;
$conf->{db_path} = File::Spec->catfile( $conf->{path}, $found[0] );
$conf->{db_type} = $paths{$found[0]};
return $conf->{db_type};
Expand Down

0 comments on commit 33053c8

Please sign in to comment.