3 # Author: James Brister <brister@vix.com> -- berkeley-unix --
4 # Start Date: Sun, 19 Jan 1997 21:19:24 +0100
5 # Project: INN (innfeed)
6 # File: innfeed-convcfg.in
7 # RCSId: $Id: innfeed-convcfg.in 2680 1999-11-15 06:37:43Z rra $
8 # Description: Read in a old version of innfeed.conf on the command line
9 # or on stdin, and write a new version on stdout.
22 'backlog-rotate-period',
23 'backlog-ckpt-period',
24 'backlog-newfile-period',
31 'host-queue-highwater',
35 'initial-reconnect-time',
38 'initial-connections',
47 'backlog-limit-highwater'
51 'pid-file', 'innfeed.pid',
54 'log-file', 'innfeed.log',
56 'backlog-directory', 'innfeed',
57 'backlog-rotate-period', '60',
58 'backlog-ckpt-period', '30',
59 'backlog-newfile-period', '600',
61 'dns-expire', '86400',
62 'close-period', '3600',
64 'status-file', 'innfeed.status',
65 'connection-stats', 'false',
66 'host-queue-highwater', '10',
67 'stats-period', '600',
68 'stats-reset', '43200',
69 'max-reconnect-time', '3600',
70 'initial-reconnect-time', '30',
71 'article-timeout', '600',
72 'response-timeout', '300',
73 'initial-connections', '1',
74 'max-connections', '5',
75 'max-queue-size', '25',
77 'no-check-high', '195.0',
78 'no-check-low', '90.0',
81 'backlog-factor', '1.10',
82 'backlog-limit-highwater', '0',
85 %defaultKeys = ('article-timeout', 1,
86 'response-timeout', 1,
87 'initial-connections', 1,
96 @defaultOrder = ('article-timeout',
98 'initial-connections',
109 foreach $key (keys %procDefaults) {
110 $max = length ($key) if length ($key) > $max ;
111 if ($procDefaults{$key} =~ /^true$/i || $procDefaults{$key} =~ /^false$/i){
112 $formats{$key} = "%s" ;
113 } elsif ($procDefaults{$key} =~ /^\d+$/) {
114 $formats{$key} = "%d" ;
115 } elsif ($procDefaults{$key} =~ /^\d+\.\d*$/) {
116 $formats{$key} = "%.4f" ;
118 $formats{$key} = "%s" ;
130 if ($F[0] eq "default") {
131 $procDefaults{'article-timeout'} = $F[2] ;
132 $procDefaults{'response-timeout'} = $F[3] ;
133 $procDefaults{'initial-connections'} = $F[4] ;
134 $procDefaults{'max-connections'} = $F[5] ;
135 $procDefaults{'max-queue-size'} = $F[6] ;
136 $procDefaults{'streaming'} = $F[7] ;
137 $procDefaults{'no-check-low'} = $F[8] * 10.0 ;
138 $procDefaults{'no-check-high'} = $F[9] * 10.0 ;
139 $procDefaults{'port-number'} = $F[10] ;
141 printf "## This file was automatically generated created by $0\n" ;
142 printf "## On %s##\n\n", &ctime(time) ;
144 foreach $key (@keyorder) {
145 next if $defaultKeys{$key} ;
147 die "No format for $key\n" unless $formats{$key} ;
148 $format = "%${max}s:\t" . $formats{$key} . "\n" ;
149 printf $format, $key, $procDefaults{$key} ;
152 printf "\n\n## Defaults merged from:\n##\t$_\n\n" ;
153 foreach $key (@defaultOrder) {
154 die "No format for $key\n" unless $formats{$key} ;
155 $format ="%${max}s:\t" . $formats{$key} . "\n" ;
156 printf $format, $key, $procDefaults{$key} ;
161 die "Badly formed line: $0\n" ;
164 $gotDefault = 1 ; # warn only one time.
165 warn "No default line was present.\n" ;
168 print "## Peer created from:\n" ;
170 printf "peer %s {\n", $F[0] ;
172 printf "\tip-name: $F[1]\n" if $F[1] && $F[0] ne $F[1] ;
173 printf "\tarticle-timeout: %d\n", $F[2] if $F[2] ;
174 printf "\tresponse-timeout: %d\n", $F[3] if $F[3] ;
175 printf "\tinitial-connections: %d\n", $F[4] if ($F[4] ne "") ;
176 printf "\tmax-connections: %d\n", $F[5] if ($F[5] ne "") ;
177 printf "\tmax-queue-size: %d\n", $F[6] if ($F[6] ne "") ;
178 printf "\tstreaming: %s\n", $F[7] if ($F[7] ne "") ;
179 printf "\tno-check-high: %0.2f\n", $F[9] * 10.0 if ($F[9] ne "") ;
180 printf "\tno-check-low: %0.2f\n", $F[8] * 10.0 if ($F[8] ne "") ;
181 printf "\tport-number: %d\n", $F[10] if ($F[10] ne "") ;