lilalo

annotate l3config.pm @ 33:e22df843b512

Поддержка /l3/current/index
author devi
date Mon Nov 14 09:16:28 2005 +0200 (2005-11-14)
parents 196c82b6e538
children 34f3ce44c365
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@27 83 "backend_address" => "127.0.0.1",
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@30 127
devi@23 128 );
devi@23 129
devi@23 130 sub read_config_file
devi@23 131 {
devi@23 132 my $config = $_[0];
devi@23 133 my $filename = $_[1];
devi@23 134 open(CONFIG, "$filename")
devi@23 135 or return;
devi@23 136 while (<CONFIG>) {
devi@23 137 s/#.*//;
devi@23 138 next if /^\s*$/;
devi@23 139 my ($var, $val) = split /\s*=\s*/, $_, 2;
devi@23 140 $var =~ s/\s*//;
devi@23 141 $config->{$var} = $val;
devi@23 142 }
devi@23 143 close(CONFIG);
devi@23 144 }
devi@23 145
devi@23 146
devi@23 147 sub init_config
devi@23 148 {
devi@23 149 my %argv_config;
devi@23 150 my %file_config;
devi@32 151 read_config_file(\%file_config, $System_Config_File);
devi@32 152 read_config_file(\%file_config, $User_Config_File);
devi@23 153 GetOptions(\%argv_config, map "$_=s", keys %Config);
devi@23 154 %Config = (%Config, %file_config, %argv_config);
devi@23 155 }
devi@23 156