summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-20 06:33:21 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-20 06:33:21 +0000
commitb1e7506c0779129f3d6bc9f6dc68987d423ae8a9 (patch)
tree7627f44e64f56506a19fae20893541703c0ad0e0
parent05f273f6a72d57872454286497319e9f9209559b (diff)
Cleaning up Sysconfig assignement code
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@958 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--LedgerSMB/Sysconfig.pm52
1 files changed, 26 insertions, 26 deletions
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index d7526c29..1d653465 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -69,39 +69,39 @@ $localepath = 'locale/po';
my %config;
read_config('ledgersmb.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} .= $pathsep.(join $pathsep, @{$config{environment}{PATH}}) if
- $config{environment}{PATH};
-$ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
- $config{environment}{PERL5LIB};
+# Root variables
+for $var (qw(pathsep logging check_max_invoices language session latex)){
+ ${$var} = $config{''}{$var} if $config{''}{$var};
+}
%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}{templates} if $config{paths}{templates};
-$images = $config{paths}{images} if $config{paths}{images};
+# ENV Paths
+for $var (qw(PATH PERL5LIB)){
+$ENV{$var} .= $pathsep.(join $pathsep, @{$config{environment}{$var}}) if
+ $config{environment}{$var};
+}
+
+# Application-specific paths
+for $var (qw(localepath spool templates images)){
+ ${$var} = $config{paths}{$var} if $config{paths}{$var};
+}
+
+# Programs
+for $var (qw(gzip)){
+ ${$var} = $config{programs}{$var} if $config{programs}{$var};
+}
-$gzip = $config{programs}{gzip} if $config{programs}{gzip};
+# mail configuration
+for $var (qw(sendmail smpthost smtptimeout)){
+ ${$var} = $config{mail}{$var} if $config{mail}{$var};
+}
-$sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
-$smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
-$smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
# We used to have a global dbconnect but have moved to single entries
-$globalDBhost = $config{globaldb}{DBhost} if $config{globaldb}{DBhost};
-$globalDBport = $config{globaldb}{DBport} if $config{globaldb}{DBport};
-$globalDBname = $config{globaldb}{DBname} if $config{globaldb}{DBname};
-$globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
-$globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
+for $var (qw(DBhost DBport DBname DBUserName DBPassword)){
+ ${"global".$var} = $config{globaldb}{$var} if $config{globaldb}{$var};
+}
#putting this in an if clause for now so not to break other devel users
if ($config{globaldb}{DBname}){