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