]> Frank Brehm's Git Trees - books.git/commitdiff
Modell-Konfiguration auf native Konfiguration geändert
authorFrank Brehm <frank@brehm-online.com>
Sun, 29 Mar 2009 11:17:29 +0000 (11:17 +0000)
committerFrank Brehm <frank@brehm-online.com>
Sun, 29 Mar 2009 11:17:29 +0000 (11:17 +0000)
frbr_books.yml
lib/FrBr/Books/Model/Schema.pm
lib/FrBr/Books/Plugin/ConfigLoader.pm

index bbac7a1a113f138f3568c2085f27d41ae94dd069..0ad7f6a8412cbc8f6fe9d58520110d75b1d8bbde 100644 (file)
@@ -17,12 +17,18 @@ default_list_length:    20
 # 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
index 4de727989524f8b92f92b60d5b6aebe15e932667..b738794347b566e0b3d1c4fdb035038fd0d0288d 100644 (file)
@@ -7,11 +7,11 @@ use strict;
 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,
index 22474638aebfc59e9d2fc3b5a02b0783fa088e77..92efcfd7cc4cc934d7605e5ccd2791a14a0965f8 100644 (file)
@@ -70,26 +70,6 @@ sub finalize_config {
     $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