Mercurial > hg > savane-forge
changeset 9:e8493a8de321
Fix a merge conflict
author | Jonathan Gonzalez V <zeus@lunareja.(none)> |
---|---|
date | Tue, 20 Jan 2009 00:38:47 -0300 |
parents | f0b803d71232 (current diff) 0ab3d65e56e3 (diff) |
children | f0e4d4b17bee |
files | lib/Savane.pm |
diffstat | 3 files changed, 38 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/Savane.pm +++ b/lib/Savane.pm @@ -32,8 +32,8 @@ __PACKAGE__->setup(qw/-Debug ConfigLoader Static::Simple/); __PACKAGE__->config->{static}->{dirs} = [ - 'static', - qr/^(images|css)/, + 'static', + qr/^(images|css)/, ]; =head1 NAME
--- a/lib/Savane/Model/DB.pm +++ b/lib/Savane/Model/DB.pm @@ -3,13 +3,36 @@ use strict; use base 'Catalyst::Model::DBIC::Schema'; -__PACKAGE__->config( - schema_class => 'Savane::Schema', - connect_info => [ - 'dbi:mysql:dbname=savane_dev', - 'root', - ], -); +# Gather DBI configuration from config + +if (my $db_conf = Savane->config->{database}) +{ + die "fatal error: 'database' not configured in database configuration\n" + unless $db_conf->{database}; + + die "fatal error: 'user' not configured in database configuration\n" + unless $db_conf->{user}; + + my $dbi_string = "dbi:mysql:dbname=$db_conf->{database}"; + $dbi_string .= ";host=$db_conf->{host}" if $db_conf->{host}; + $dbi_string .= ";host=$db_conf->{port}" if $db_conf->{port}; + + my @user_auth = ( $db_conf->{user} ); + push @user_auth, $db_conf->{password} if $db_conf->{password}; + + __PACKAGE__->config( + schema_class => 'Savane::Schema', + connect_info => [ + $dbi_string, + @user_auth + ], + ); +} +else +{ + die "fatal error: database settings not configured in ./savane.conf\n"; +} + =head1 NAME