# Sitzungsparameter
session:
expires: 7200
-database:
- host: localhost
- port: 3306
- schema: books
- user: books
- # passwd:
+#
+# Direkte Modell-Konfiguration:
+'Model::Schema':
+ schema_class: 'FrBr::Books::Db'
+ connect_info:
+ - 'DBI:mysql:database=books;host=localhost'
+ - 'books'
+ - ~
+ - AutoCommit: 1
+ PrintError: 0
+ RaiseError: 0
+#
authentication:
dbic:
# Note this first definition would be the same as setting
use base 'Catalyst::Model::DBIC::Schema';
__PACKAGE__->config(
- schema_class => 'FrBr::Books::Db',
+ 'schema_class' => 'FrBr::Books::Db',
'connect_info' => [
- $ENV{'FRBR_BOOKS_DSN'} || 'dbi:mysql:database=books;host=localhost',
- $ENV{'FRBR_BOOKS_USER'} || 'books',
- $ENV{'FRBR_BOOKS_PWD'} || '',
+ 'dbi:mysql:database=books;host=localhost',
+ 'books',
+ '',
{ 'AutoCommit' => 1,
'PrintError' => 0,
'RaiseError' => 0,
$c->log->debug( $K . "Log4perl-Konfiguration:\n" . $log4perlconf ) if $c->config->{'debug_level'} >= 1;
$c->log( Catalyst::Log::Log4perl->new( \$log4perlconf ) );
- my $dsn = 'dbi:mysql:host=%s;database=%s';
-
- $dsn = sprintf( $dsn, ( $c->config()->{'database'}->{'host'} || 'localhost' ),
- ( $c->config()->{'database'}->{'schema'} || 'books' ) );
-
- my $port = 3306;
- if ( $c->config()->{'database'}->{'port'} and to_int( $c->config()->{'database'}->{'port'} ) ) {
- $port = $c->config()->{'database'}->{'port'};
- }
- $port = $port == 3306 ? '' : ';port=' . $port;
- $dsn .= $port;
-
- $c->config()->{'dsn'} = $dsn;
- $c->config()->{'db_user'} = $c->config()->{'database'}->{'user'} || 'cookbook';
- $c->config()->{'db_passwd'} = $c->config()->{'database'}->{'passwd'} || '';
-
- $ENV{'FRBR_BOOKS_DSN'} = $dsn;
- $ENV{'FRBR_BOOKS_USER'} = $c->config()->{'db_user'};
- $ENV{'FRBR_BOOKS_PWD'} = $c->config()->{'db_passwd'};
-
$c->log->debug( get_output_string( $K, "Aktuelle Konfiguration: ", $c->config ) ) if $c->config->{'debug_level'} >= 3;
} ## end sub finalize_config