X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDispatcher.pm;h=9ba2b70cfc2563f966e3ab987f23671f200b4d52;hb=2b3391521b469f9f7b2928d104a9f620dddb25d2;hp=57e2b545bc5262d78838ec9ac95d8d0bd0bb651d;hpb=8cd05ad64866ce200f888a35723ae4b7e24a2012;p=kivitendo-erp.git 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;