Revision 2b82ec61
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Dispatcher.pm | ||
---|---|---|
77 | 77 |
|
78 | 78 |
read_config 'config/lx_office.conf' => %::lx_office_conf; |
79 | 79 |
_decode_recursively(\%::lx_office_conf); |
80 |
_init_environment(); |
|
80 | 81 |
|
81 | 82 |
eval { |
82 | 83 |
package main; |
... | ... | |
334 | 335 |
} |
335 | 336 |
} |
336 | 337 |
|
338 |
sub _init_environment { |
|
339 |
my %key_map = ( lib => { name => 'PERL5LIB', append_path => 1 }, |
|
340 |
path => { name => 'PATH', append_path => 1 }, |
|
341 |
); |
|
342 |
my $cfg = $::lx_office_conf{environment} || {}; |
|
343 |
|
|
344 |
while (my ($key, $value) = each %{ $cfg }) { |
|
345 |
next unless $value; |
|
346 |
|
|
347 |
my $info = $key_map{$key} || {}; |
|
348 |
$key = $info->{name} || $key; |
|
349 |
|
|
350 |
if ($info->{append_path}) { |
|
351 |
$value = ':' . $value unless $value =~ m/^:/ || !$ENV{$key}; |
|
352 |
$value = $ENV{$key} . $value; |
|
353 |
} |
|
354 |
|
|
355 |
$ENV{$key} = $value; |
|
356 |
} |
|
357 |
} |
|
358 |
|
|
337 | 359 |
package main; |
338 | 360 |
|
339 | 361 |
use strict; |
Auch abrufbar als: Unified diff
Initialisierung von %ENV von lx-erp.conf nach lx_office.conf verschoben