lilalo

annotate l3config.pm @ 52:f9447da96f15

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