X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8cd05ad64866ce200f888a35723ae4b7e24a2012..f2af9def6777d0192a83c8a86f1332569c742051:/SL/Dispatcher.pm diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 57e2b545b..9ba2b70cf 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -77,6 +77,7 @@ sub pre_startup_setup { read_config 'config/lx_office.conf' => %::lx_office_conf; _decode_recursively(\%::lx_office_conf); + _init_environment(); eval { package main; @@ -88,7 +89,6 @@ sub pre_startup_setup { { no warnings 'once'; $::menufile = "menu.ini"; - $::sendmail = "| /usr/sbin/sendmail -t"; $::lxdebug = LXDebug->new; $::auth = SL::Auth->new; $::form = undef; @@ -334,6 +334,27 @@ sub _decode_recursively { } } +sub _init_environment { + my %key_map = ( lib => { name => 'PERL5LIB', append_path => 1 }, + path => { name => 'PATH', append_path => 1 }, + ); + my $cfg = $::lx_office_conf{environment} || {}; + + while (my ($key, $value) = each %{ $cfg }) { + next unless $value; + + my $info = $key_map{$key} || {}; + $key = $info->{name} || $key; + + if ($info->{append_path}) { + $value = ':' . $value unless $value =~ m/^:/ || !$ENV{$key}; + $value = $ENV{$key} . $value; + } + + $ENV{$key} = $value; + } +} + package main; use strict;