summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-29 05:29:28 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-29 05:29:28 +0000
commit25fa6cce726b49c32029d698924c472ace81073e (patch)
tree1b3eca865a2b7828b9289ffbbe6564a31fea189b /LedgerSMB
parentfda00ca36161398bc22c4dd230956c9351fcdd4e (diff)
Switch main config file to using Config::Std
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@374 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/Sysconfig.pm35
1 files changed, 31 insertions, 4 deletions
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index 3c5cb348..a8b2e827 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -4,6 +4,8 @@
package LedgerSMB::Sysconfig;
+use Config::Std;
+
$session='DB';
$logging=0; # No logging on by default
@@ -53,10 +55,35 @@ my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432';
my $globalUserName = "ledgersmb";
my $globalPassword = "set me to correct password";
-eval { require "ledger-smb.conf"; };
-if ($@){
- print STDERR "Parsing ledger-smb.conf failed: $@";
-}
+my %config;
+read_config('ledger-smb.conf' => %config) or die;
+
+$logging = $config{''}{logging} if $config{''}{logging};
+$check_max_invoices = $config{''}{check_max_invoices} if
+ $config{''}{check_max_invoices};
+$language = $config{''}{language} if $config{''}{language};
+$session = $config{''}{session} if $config{''}{session};
+$latex = $config{''}{latex} if $config{''}{latex};
+
+$ENV{PATH} .= ":".(join ':', @{$config{environment}{PATH}}) if
+ $config{environment}{PATH};
+$ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
+ $config{environment}{PERL5LIB};
+
+%printer = %{$config{printers}} if $config{printers};
+
+$memberfile = $config{paths}{memberfile} if $config{paths}{memberfile};
+$userspath = $config{paths}{userspath} if $config{paths}{userspath};
+$localepath = $config{paths}{localepath} if $config{paths}{localepath};
+$spool = $config{paths}{spool} if $config{paths}{spool};
+$templates = $config{paths}{tempates} if $config{paths}{tempates};
+
+$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);