summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LedgerSMB/Sysconfig.pm21
-rw-r--r--ledger-smb.conf10
2 files changed, 18 insertions, 13 deletions
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index a8b2e827..962c16fc 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -5,6 +5,8 @@
package LedgerSMB::Sysconfig;
use Config::Std;
+use DBI qw(:sql_types);
+
$session='DB';
$logging=0; # No logging on by default
@@ -46,15 +48,6 @@ $localepath = 'locale/po';
Epson => 'lpr -PEpson',
);
-#################################
-# Global database parameters
-#################################
-# These parameters *must* be set correctly
-# for LedgerSMB >= 1.2 to work
-my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432';
-my $globalUserName = "ledgersmb";
-my $globalPassword = "set me to correct password";
-
my %config;
read_config('ledger-smb.conf' => %config) or die;
@@ -82,11 +75,13 @@ $sendmail = $config{programs}{sendmail} if $config{programs}{sendmail};
$gzip = $config{programs}{gzip} if $config{programs}{gzip};
$globalDBConnect = $config{globaldb}{DBConnect} if $config{globaldb}{DBConnect};
-$globalUserName = $config{globaldb}{UserName} if $config{globaldb}{UserName};
-$globalPassword = $config{globaldb}{Password} if $config{globaldb}{Password};
-
-#$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword);
+$globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
+$globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
+#putting this in an if clause for now so not to break other devel users
+if ($config{globaldb}{DBConnect}){
+ $GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword) or die;
+}
# These lines prevent other apps in mod_perl from seeing the global db
# connection info
diff --git a/ledger-smb.conf b/ledger-smb.conf
index 737dc901..07072266 100644
--- a/ledger-smb.conf
+++ b/ledger-smb.conf
@@ -6,3 +6,13 @@ PATH: /usr/local/pgsql/bin
# on mac os X using Fink's Perl libs, add the path
#PERL5LIB: /sw/lib/perl5
+#################################
+# Global database parameters
+#################################
+# These parameters *must* be set correctly for LedgerSMB >= 1.2 to work
+#
+[globaldb]
+##uncomment and set these
+#DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
+#DBUserName: ledgersmb
+#DBPassword: password