lilalo

view l3config.pm @ 30:f5f07049bd4f

l3-agent:
Исправлен баг с инициализацией session_id

l3-cgi:
* Добавлена поддержка index-страницы.
При обращении на /cgi-bin/l3/index показывается таблица
с ссылками на журналы всех тренингов
В самом журнале корректно показывается информация
о курсе.

* Поскольку термин "class" перегружен, вместо него теперь
используется термин "training".
В дальнейшем такая замена произойдёт во всём коде.

* Теперь l3-cgi использует конфигурационный модуль l3config.pm
Загрузка выполняется с помощью require на этапе исполнения

l3config.pm:
Перенесены конфигурационные параметры lm.
ОСТОРОЖНО! Сам lm ПОКА ЧТО не использует l3config.pm для конфигурирования.
author devi
date Tue Nov 08 12:16:20 2005 +0200 (2005-11-08)
parents 450b6ac9b657
children 196c82b6e538
line source
1 package l3config;
3 use Exporter;
4 use vars qw(@ISA @EXPORT $VERSION);
5 use Getopt::Long;
7 @ISA = ('Exporter');
8 @EXPORT = qw(%Config &init_config);
10 our $Config_File = "labmaker.conf";
11 our %Config = (
12 "skip_empty" => "yes",
13 "skip_interrupted" => "no",
14 "skip_wrong" => "no",
15 "editors" => ["vi", "pico", "ee", "vim", "nano"],
16 "pagers" => ["more", "less", "zmore", "zless", "info",
17 "man", "mc", "trafshow", "screen", "cfdisk",
18 "trafshow-bsd", "yes", "lynx", "links", "centericq"
19 ],
20 "terminal" => ["mc"],
21 "suppress_editors" => "yes",
22 "suppress_pagers" => "yes",
23 "suppress_terminal" => "yes",
25 "terminal_width" => 100,
26 "terminal_height" => 100,
27 "verbose" => "yes",
29 "head_lines" => 5,
30 "tail_lines" => 5,
31 "cache_head_lines" => 5,
32 "cache_tail_lines" => 5,
33 "skip_text" => "...",
34 "show_time" => "yes",
35 "show_diffs" => "yes",
36 "show_comments" => "yes",
38 "input" => "/root/.labmaker",
39 "diffs" => "",
40 "input_mask" => "*.script",
41 "encoding" => "utf-8",
43 "cache" => "/tmp/report.xml",
44 "cache_stat" => "/tmp/.report.dat",
46 "output" => "/tmp/report.html",
47 #"output" => "report.xml",
48 "output_mask" => "INDEX",
49 "output_format" => "html",
50 "frontend_css" => "/l3/l3.css",
51 "frontend_google_ico" => "/l3/google.ico",
52 "frontend_linux_ico" => "/l3/linux.ico",
53 "frontend_freebsd_ico" => "/l3/freebsd.ico",
54 "frontend_opennet_ico" => "/l3/opennet.ico",
55 "frontend_local_ico" => "/l3/freebsd.ico",
57 "signature" => "#lm:",
58 "from" => "",
59 "to" => "",
60 "lab" => "",
61 "keywords" => "linux command",
62 "files_keywords" => "linux file",
64 comment_width => "300",
65 time_width => "60",
67 "mode" => "daemon", # daemon | normal
68 "daemon_sleep_interval" => "1",
69 "detach" => "yes",
70 "agent_pidfile" => "$ENV{HOME}/.labmaker/l3-agent.pid",
72 "backend_address" => "127.0.0.1",
73 "backend_port" => "18030",
74 "backend_pidfile" => "/tmp/l3-backend.pid",
75 "backend_datafile" => "/tmp/backend.xml",
77 "l3-agent" => "l3-agent",
78 "l3-backend" => "l3-backend",
80 "course-name" => "",
81 "course-code" => "",
82 "course-date" => "",
83 "course-center" => "",
84 "course-trainer" => "",
85 "course-student" => "",
88 #lm
89 "show_host" => "no",
91 # Вспомогательные программы
92 #"l3-report" => "./lm-report",
93 "l3-report" => "./l3-report",
95 # Каталоги
96 "path_lilalo" => "/var/lilalo/",
97 "path_classes" => "/var/lilalo/classes/",
98 "path_lablogs" => "/var/lilalo/lablogs/",
99 "courses_path" => "/var/lilalo/courses/",
100 "outpath" => "/var/lilalo/out/",
101 "path_web" => "/var/www/l3", # Путь к web-отчётам
102 "path_share" => "./share/", # Путь к web-отчётам
104 # Файлы
105 "runfile" => "lm.run",
106 "logfile" => "lm.log",
108 "class" => "class", # Имя файла класса
109 "class_suffix" => ".xml", # Cуффикс файла класса
110 "classfile" => "",
112 "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub",
113 "lmssh" => "./lm-ssh",
114 "lminstall" => "./lm-install",
115 "ssh_user" => "root",
117 );
119 sub read_config_file
120 {
121 my $config = $_[0];
122 my $filename = $_[1];
123 open(CONFIG, "$filename")
124 or return;
125 while (<CONFIG>) {
126 s/#.*//;
127 next if /^\s*$/;
128 my ($var, $val) = split /\s*=\s*/, $_, 2;
129 $var =~ s/\s*//;
130 $config->{$var} = $val;
131 }
132 close(CONFIG);
133 }
136 sub init_config
137 {
138 my %argv_config;
139 my %file_config;
140 read_config_file(\%file_config, $Config_File);
141 GetOptions(\%argv_config, map "$_=s", keys %Config);
142 %Config = (%Config, %file_config, %argv_config);
143 }