add "port" as a setting for the Pg driver
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 15:14:42 +0000 (15:14 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 15:14:42 +0000 (15:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2368 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg.pm

index f4c3335..bde3e7d 100644 (file)
                );
 
                my $master = shift @$_db_params;
+               $$master{port} ||= '5432';
+               $$master{host} ||= 'localhost';
+               $$master{db} ||= 'openils';
+
                $log->debug("Attmpting to connet to $$master{db} at $$master{host}", INFO);
 
                try {
-                       $master_db = DBI->connect("dbi:Pg:host=$$master{host};dbname=$$master{db}",$$master{user},$$master{pw}, \%attrs) ||
-                               throw OpenSRF::EX::ERROR ("Couldn't connect to $$master{db} on $$master{host} as $$master{user}!!");
+                       $master_db = DBI->connect(
+                               "dbi:Pg:".
+                                       "host=$$master{host};".
+                                       "port=$$master{port};".
+                                       "dbname=$$master{db}",
+                               $$master{user},
+                               $$master{pw},
+                               \%attrs) ||
+                                       throw OpenSRF::EX::ERROR
+                                               ("Couldn't connect to $$master{db}".
+                                                " on $$master{host}::$$master{port}".
+                                                " as $$master{user}!!");
                } catch Error with {
                        my $e = shift;
                        $log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);