From 6e08b2d6c04a17203af125f2b82cce706550a51d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 2 Jul 2002 14:11:49 +0000 Subject: Trimmed down config file and set sane defaults --- Echolot/Config.pm | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Config.pm b/Echolot/Config.pm index f679af8..4ad4246 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.1 2002/06/05 04:05:40 weasel Exp $ +# $Id: Config.pm,v 1.2 2002/07/02 14:11:49 weasel Exp $ # =pod @@ -22,12 +22,45 @@ use Carp; my $CONFIG; -sub init() { +sub init($) { + my ($params) = @_; + my $DEFAULT; $DEFAULT->{'recipient_delimiter'} = '+'; $DEFAULT->{'dev_random'} = '/dev/random'; $DEFAULT->{'hash_len'} = 8; + $DEFAULT = { + addresses_default_ttl => 5, # days + smarthost => 'localhost', + mailindir => 'mail/IN', + mailerrordir => 'mail/ERROR', + ping_new => 1, + show_new => 1, + pinger_interval => 300, + ping_every_nth_time => 48, + resultdir => 'results', + gnupghome => 'gnupg', + tmpdir => 'tmp', + prospective_addresses_ttl => 432000, # 5 days + reliable_auto_add_min => 3, # 3 remailes need to list new address + commands_file => 'commands.txt', + pidfile => 'pingd.pid', + expire_keys => 432000, # 5 days + expire_confs => 432000, # 5 days + expire_pings => 1123200, # 12 days + storage => { + backend => 'File', + File => { + basedir => 'data' + } + }, + + homedir => undef, + my_localpart => undef, + my_domain => undef, + }; + { my $parser = new XML::Parser(Style => 'Tree'); my $tree = $parser->parsefile('pingd.conf'); @@ -38,6 +71,15 @@ sub init() { for my $key (keys %$DEFAULT) { $CONFIG->{$key} = $DEFAULT->{$key} unless defined $CONFIG->{$key}; }; + + for my $key (keys %$params) { + $CONFIG->{$key} = $DEFAULT->{$key} if defined $CONFIG->{$key}; + }; + + + for my $key (keys %$CONFIG) { + warn ("Config option $key is not defined\n") unless defined $CONFIG->{$key}; + }; }; sub get() { -- cgit v1.2.3