lilalo

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