Revision f04a7950
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
.gitignore | ||
---|---|---|
3 | 3 |
/users/datev-export* |
4 | 4 |
/users/templates-cache/ |
5 | 5 |
/users/pid/ |
6 |
/config/task_server.conf |
|
7 |
/config/periodic_invoices.conf |
|
6 |
/config/lx_office.conf |
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
184 | 184 |
sub _send_email { |
185 | 185 |
my ($posted_invoices, $printed_invoices) = @_; |
186 | 186 |
|
187 |
read_config 'config/periodic_invoices.conf' => my %config;
|
|
187 |
read_config 'config/lx_office.conf' => my %config;
|
|
188 | 188 |
|
189 | 189 |
return if !$config{periodic_invoices} || !$config{periodic_invoices}->{send_email_to} || !scalar @{ $posted_invoices }; |
190 | 190 |
|
SL/Dispatcher.pm | ||
---|---|---|
9 | 9 |
} |
10 | 10 |
|
11 | 11 |
use CGI qw( -no_xhtml); |
12 |
use Config::Std; |
|
12 | 13 |
use DateTime; |
14 |
use Encode; |
|
13 | 15 |
use English qw(-no_match_vars); |
14 | 16 |
use SL::Auth; |
15 | 17 |
use SL::LXDebug; |
... | ... | |
92 | 94 |
$::form = undef; |
93 | 95 |
%::myconfig = (); |
94 | 96 |
%::called_subs = (); # currently used for recursion detection |
97 |
|
|
98 |
read_config 'config/lx_office.conf' => %::lx_office_conf if -f "config/lx_office.conf"; |
|
99 |
_decode_recursively(\%::lx_office_conf); |
|
95 | 100 |
} |
96 | 101 |
|
97 | 102 |
$SIG{__WARN__} = sub { |
... | ... | |
320 | 325 |
return $self->{interface} =~ m/f(?:ast)cgi/i ? $self->{request}->GetHandles() : (\*STDIN, \*STDOUT, \*STDERR); |
321 | 326 |
} |
322 | 327 |
|
328 |
sub _decode_recursively { |
|
329 |
my ($obj) = @_; |
|
330 |
|
|
331 |
while (my ($key, $value) = each %{ $obj }) { |
|
332 |
if (ref($value) eq 'HASH') { |
|
333 |
_decode_recursively($value); |
|
334 |
} else { |
|
335 |
$obj->{$key} = decode('UTF-8', $value); |
|
336 |
} |
|
337 |
} |
|
338 |
} |
|
339 |
|
|
323 | 340 |
package main; |
324 | 341 |
|
325 | 342 |
use strict; |
config/console.conf.default | ||
---|---|---|
1 |
[Console] |
|
2 |
|
|
3 |
# autologin to use if none is given |
|
4 |
login = demo |
|
5 |
|
|
6 |
# autorun lines will be executed after autologin. |
|
7 |
# be warned that loading huge libraries will noticably lengthen startup time. |
|
8 |
#autorun = use SL::Module |
|
9 |
# = use SL::Other::Module |
|
10 |
|
|
11 |
# location of history file for permanent history |
|
12 |
history_file = users/console_history |
|
13 |
|
config/lx_office.conf.default | ||
---|---|---|
1 |
[task_server] |
|
2 |
# User name to use for database access |
|
3 |
login = mb |
|
4 |
# Set to 1 for debug messages in /tmp/lx-office-debug.log |
|
5 |
debug = 1 |
|
6 |
# Chose a system user the daemon should run under when started as root. |
|
7 |
run_as = |
|
8 |
|
|
9 |
[periodic_invoices] |
|
10 |
# The user name a report about the posted and printed invoices is sent |
|
11 |
# to. |
|
12 |
send_email_to = login |
|
13 |
# The "From:" header for said email. |
|
14 |
email_from = Lx-Office Daemon <root@localhost> |
|
15 |
# The subject for said email. |
|
16 |
email_subject = Benachrichtigung: automatisch erstellte Rechnungen |
|
17 |
# The template file used for the email's body. |
|
18 |
email_template = templates/webpages/oe/periodic_invoices_email.txt |
|
19 |
|
|
20 |
[Console] |
|
21 |
# autologin to use if none is given |
|
22 |
login = demo |
|
23 |
|
|
24 |
# autorun lines will be executed after autologin. |
|
25 |
# be warned that loading huge libraries will noticably lengthen startup time. |
|
26 |
#autorun = use SL::Module |
|
27 |
# = use SL::Other::Module |
|
28 |
|
|
29 |
# location of history file for permanent history |
|
30 |
history_file = users/console_history |
config/periodic_invoices.conf.default | ||
---|---|---|
1 |
[periodic_invoices] |
|
2 |
# The user name a report about the posted and printed invoices is sent |
|
3 |
# to. |
|
4 |
send_email_to = login |
|
5 |
# The "From:" header for said email. |
|
6 |
email_from = Lx-Office Daemon <root@localhost> |
|
7 |
# The subject for said email. |
|
8 |
email_subject = Benachrichtigung: automatisch erstellte Rechnungen |
|
9 |
# The template file used for the email's body. |
|
10 |
email_template = templates/webpages/oe/periodic_invoices_email.txt |
config/task_server.conf.default | ||
---|---|---|
1 |
[task_server] |
|
2 |
# User name to use for database access |
|
3 |
login = |
|
4 |
# Set to 1 for debug messages in /tmp/lx-office-debug.log |
|
5 |
debug = 0 |
|
6 |
# Chose a system user the daemon should run under when started as root. |
|
7 |
run_as = www |
scripts/console | ||
---|---|---|
14 | 14 |
use Devel::REPL 1.002001; |
15 | 15 |
use Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users |
16 | 16 |
|
17 |
read_config 'config/console.conf' => my %config;# if -f 'config/console.conf';
|
|
17 |
read_config 'config/lx_office.conf' => my %config;
|
|
18 | 18 |
|
19 | 19 |
my $login = shift || $config{Console}{login} || 'demo'; |
20 | 20 |
my $history_file = $config{Console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable |
... | ... | |
41 | 41 |
use CGI qw( -no_xhtml); |
42 | 42 |
use DateTime; |
43 | 43 |
use SL::Auth; |
44 |
use SL::Dispatcher; |
|
44 | 45 |
use SL::Form; |
45 | 46 |
use SL::Helper::DateTime; |
46 | 47 |
use SL::Locale; |
... | ... | |
73 | 74 |
$::form = Form->new; |
74 | 75 |
$::auth = SL::Auth->new; |
75 | 76 |
|
77 |
read_config 'config/lx_office.conf' => %::lx_office_conf; |
|
78 |
SL::Dispatcher::_decode_recursively(\%::lx_office_conf); |
|
79 |
|
|
76 | 80 |
die 'cannot reach auth db' unless $::auth->session_tables_present; |
77 | 81 |
|
78 | 82 |
$::auth->restore_session; |
... | ... | |
193 | 197 |
|
194 | 198 |
Configuration of this script is located in: |
195 | 199 |
|
196 |
config/console.conf
|
|
197 |
config/console.conf.default
|
|
200 |
config/lx_office.conf
|
|
201 |
config/lx_office.conf.default
|
|
198 | 202 |
|
199 | 203 |
See there for interesting options. |
200 | 204 |
|
scripts/task_server.pl | ||
---|---|---|
145 | 145 |
|
146 | 146 |
mkdir($pidbase) if !-d $pidbase; |
147 | 147 |
|
148 |
newdaemon(configfile => "${cwd}/config/task_server.conf",
|
|
148 |
newdaemon(configfile => "${cwd}/config/lx_office.conf",
|
|
149 | 149 |
progname => 'lx-office-task-server', |
150 | 150 |
pidbase => "${pidbase}/", |
151 | 151 |
); |
Auch abrufbar als: Unified diff
Zusammenfassen mehrerer Konfigurationsdateien in einer gemeinsamen