/[meteor]/trunk/Meteor/Config.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/Meteor/Config.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 49 by knops.gerd, Mon Feb 4 22:30:35 2008 UTC revision 62 by andrew.betts, Thu Nov 27 00:33:21 2008 UTC
# Line 42  package Meteor::Config; Line 42  package Meteor::Config;
42          use strict;          use strict;
43                    
44          our @DEFAULTS=(          our @DEFAULTS=(
45    'Template for each line in channelinfo.  Placeholders are name, lastMsgID, subscriberCount, messageCount.  Channel info is included in output when client does not give a message start index in its request (indicating it is the client\'s first request for that channel)',
46            ChannelInfoTemplate             => '<script>ch("~name~", ~lastMsgID~);</script>\r\n',
47    
48  'Configuration file location on disk (if any)',  'Configuration file location on disk (if any)',
49          ConfigFileLocation              => '/etc/meteord.conf',          ConfigFileLocation              => '/etc/meteord.conf',
50    
# Line 58  package Meteor::Config; Line 61  package Meteor::Config;
61          Debug                                   => 0,          Debug                                   => 0,
62                    
63  'Name of index file to serve when a directory is requested from the static file web server',  'Name of index file to serve when a directory is requested from the static file web server',
64          DirectoryIndex  => 'index.html',          DirectoryIndex                  => 'index.html',
   
 'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values.  **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template=<number> to their GET request. If *HeaderTemplate<number>* is not found, the system will use the default HeaderTemplate (no number)',  
         HeaderTemplate                  => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n<meta http-equiv="Cache-Control" content="no-store">\r\n<meta http-equiv="Cache-Control" content="no-cache">\r\n<meta http-equiv="Pragma" content="no-cache">\r\n<meta http-equiv="Expires" content="Thu, 1 Jan 1970 00:00:00 GMT">\r\n<script type="text/javascript">\r\nwindow.onError = null;\r\nvar domainparts = document.domain.split(".");\r\ndocument.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];\r\nparent.Meteor.register(this);\r\n</script>\r\n</head>\r\n<body onload="try { parent.Meteor.reset(this) } catch (e) {}">\r\n',  
65    
66  'Template for each line in channelinfo',  'Footer template',
67            FooterTemplate                  => '</body></html>',
68    
69          ChannelInfoTemplate             => '~name~ ~messageCount~ ~lastMsgID~\r\n',  'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values.',
70            HeaderTemplate                  => 'HTTP/1.1 ~status~\r\n\r\n~channelinfo~\r\n',
71    
72  'Print out this help message',  'Print out this help message',
73          Help                                    => '',          Help                                    => '',
74    
75    'Format to use for timestamps in debug output: unix or human',
76            LogTimeFormat                   => 'human',
77    
78  'Maximum age of a message in seconds',  'Maximum age of a message in seconds',
79          MaxMessageAge                   => 7200,          MaxMessageAge                   => 7200,
80    
81  'Maximum number of messages to send to a subscriber before forcing their connection to close. Use 0 to disable',  'Whether to close subscriber connections once at least one message has been sent, and there are no further messages pending.  1 to enable, 0 to disable.  Irrelevant unless Persist is set to 1.',
82          MaxMessages                             => 0,          CloseOnEvent                    => 0,
83    
84  'Maximum number of stored messages per channel',  'Maximum number of stored messages per channel',
85          MaxMessagesPerChannel   => 250,          MaxMessagesPerChannel   => 250,
# Line 85  package Meteor::Config; Line 90  package Meteor::Config;
90  'Message template, ~text~, ~id~, ~channel~ and ~timestamp~ will be replaced by the appropriate values',  'Message template, ~text~, ~id~, ~channel~ and ~timestamp~ will be replaced by the appropriate values',
91          MessageTemplate                 => '<script>p(~id~,"~channel~","~text~");</script>\r\n',          MessageTemplate                 => '<script>p(~id~,"~channel~","~text~");</script>\r\n',
92    
93  'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.',  'Interval at which PingMessage is sent to all persistent subscriber connections. Must be at least 3 if set higher than zero. Set to zero to disable.',
94          PingInterval                    => 5,          PingInterval                    => 5,
95    
96  'Persistence of a connection. Note: some modes have this hardcoded!',  'Persistence of a connection.',
   
97          Persist                                 => 0,          Persist                                 => 0,
98    
99  'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds',  'Message to be sent to all persistent subscriber connections (see above) every PingInterval seconds',
100          PingMessage                             => '<script>p(-1,"");</script>\r\n',          PingMessage                             => '<script>p(-1,"");</script>\r\n',
101    
102  'IP address for subscriber server (leave empty for all local addresses)',  'IP address for subscriber server (leave empty for all local addresses)',
# Line 102  package Meteor::Config; Line 106  package Meteor::Config;
106          SubscriberPort                  => 4670,          SubscriberPort                  => 4670,
107    
108  'Subscriber Shutdown message, sent when the subscriber server shuts down (leave empty for no message)',  'Subscriber Shutdown message, sent when the subscriber server shuts down (leave empty for no message)',
109          SubscriberShutdownMsg           => '<script>eof();</script>\r\n',          SubscriberShutdownMsg   => '<script>eof();</script>\r\n',
110    
111  'An absolute filesystem path, to be used as the document root for Meteor\'s static file web server. If left empty, no documents will be served.',  'An absolute filesystem path, to be used as the document root for Meteor\'s static file web server. If left empty, no documents will be served.',
112          SubscriberDocumentRoot  => '/usr/local/meteor/public_html',          SubscriberDocumentRoot  => '/usr/local/meteor/public_html',
113    
114  'Since Meteor is capable of serving static pages from a document root as well as streaming events to subscribers, this paramter is used to specify the URI at which the event server can be reached. If set to the root, Meteor will lose the ability to serve static pages.',  'Since Meteor is capable of serving static pages from a document root as well as streaming events to subscribers, this parameter is used to specify the URI at which the event server can be reached. If set to the root, Meteor will lose the ability to serve static pages.',
115          SubscriberDynamicPageAddress    => '/push',          SubscriberDynamicPageAddress    => '/push',
116    
117  'The syslog facility to use',  'The syslog facility to use',
# Line 141  sub updateConfig { Line 145  sub updateConfig {
145                    
146          my $debug=$class->valueForKey('Debug');          my $debug=$class->valueForKey('Debug');
147                    
148          print STDERR '-'x79 ."\nParamters:\nSource \tName and Value\n".'-'x79 ."\n" if($debug);          print STDERR '-'x79 ."\nMeteor server v$::VERSION (release date: $::RELEASE_DATE)\r\nLicensed under the terms of the GNU General Public Licence (2.0)\n".'-'x79 ."\n" if($debug);
149                    
150          my @keys=();          my @keys=();
151                    
# Line 153  sub updateConfig { Line 157  sub updateConfig {
157                    
158          foreach my $mode ('',keys %Modes)          foreach my $mode ('',keys %Modes)
159          {          {
160                    print STDERR ($mode) ? "\r\n$mode:\r\n" : "\r\nDefaults:\r\n" if($debug);
161                  foreach my $baseKey (@keys)                  foreach my $baseKey (@keys)
162                  {                  {
163                          my $foundValue=0;                          my $foundValue=0;
# Line 179  sub updateConfig { Line 184  sub updateConfig {
184                                                    
185                          next unless($foundValue);                          next unless($foundValue);
186                                                    
187                          print STDERR "\t$key\t$::CONF{$key}\n" if($debug);                          print STDERR "\t$baseKey\t$::CONF{$key}\n" if($debug);
188                                                    
189                          # Take care of escapes                          # Take care of escapes
190                          $::CONF{$key}=~s/\\(.)/                          $::CONF{$key}=~s/\\(.)/
191                                  if($1 eq 'r')                                  if($1 eq 'r') {
                                 {  
192                                          "\r";                                          "\r";
193                                  }                                  } elsif($1 eq 'n') {
                                 elsif($1 eq 'n')  
                                 {  
194                                          "\n";                                          "\n";
195                                  }                                  } elsif($1 eq 's') {
                                 elsif($1 eq 's')  
                                 {  
196                                          ' ';                                          ' ';
197                                  }                                  } elsif($1 eq 't') {
                                 elsif($1 eq 't')  
                                 {  
198                                          "\t";                                          "\t";
199                                  }                                  } elsif($1 eq '0') {
200                                  else                                          "\0";
201                                  {                                  } else {
202                                          $1;                                          $1;
203                                  }                                  }
204                          /gex;                          /gex;
# Line 244  sub setCommandLineParameters { Line 242  sub setCommandLineParameters {
242                                    
243                  my $mode='';                  my $mode='';
244                                    
245                  if($k=~s/(\..+)$//)                  if($k=~s/(\.(.+))$//)
246                  {                  {
247                          $mode=$1;                          $mode=$2;
248                          $Modes{$mode}=1;                          $Modes{$mode}=1;
249                  }                  }
250                                    
# Line 323  sub readConfig { Line 321  sub readConfig {
321                                    
322                  if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/)                  if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/)
323                  {                  {
324                          $Modes{".$1"}=1;                          $Modes{$1}=1;
325                            $mode = $1;
326                          next;                          next;
327                  }                  }
328                                    
# Line 359  sub usage { Line 358  sub usage {
358                  print STDERR <<"EOT";                  print STDERR <<"EOT";
359  $msg;  $msg;
360  For further help type $::PGM -help  For further help type $::PGM -help
361  or consult docs at http://www.meteorserver.org/  or consult docs at http://meteorserver.org/
362  EOT  EOT
363    
364          } else {          } else {
# Line 391  configuration file. The default location Line 390  configuration file. The default location
390          $Defaults{'ConfigFileLocation'}          $Defaults{'ConfigFileLocation'}
391    
392  For more information and complete documentation, see the Meteor  For more information and complete documentation, see the Meteor
393  website at http://www.meteorserver.org/  website at http://meteorserver.org/
394  EOT  EOT
395    
396          }          }

Legend:
Removed from v.49  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.26