summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Echolot/Config.pm46
-rwxr-xr-xpingd4
-rw-r--r--pingd.conf28
3 files changed, 46 insertions, 32 deletions
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 <peter@palfrader.org>
-# $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() {
diff --git a/pingd b/pingd
index 82438e3..658e049 100755
--- a/pingd
+++ b/pingd
@@ -1,7 +1,7 @@
#!/usr/bin/perl -wT
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.7 2002/07/02 13:46:48 weasel Exp $
+# $Id: pingd,v 1.8 2002/07/02 14:11:49 weasel Exp $
#
=pod
@@ -155,7 +155,7 @@ my $COMMAND = shift @ARGV;
die ("command required\n") unless defined $COMMAND;
-Echolot::Config::init();
+Echolot::Config::init( $params );
chdir( Echolot::Config::get()->{'homedir'} );
Echolot::Globals::init();
diff --git a/pingd.conf b/pingd.conf
index d2b3b36..8388467 100644
--- a/pingd.conf
+++ b/pingd.conf
@@ -3,41 +3,13 @@
<perldata>
<hash>
<item key="homedir">/home/weasel/projects/echolot/devel/echolot</item>
- <item key="storage">
- <hash>
- <item key="backend">File</item>
- <item key="File">
- <hash>
- <item key="basedir">data</item>
- </hash>
- </item>
- </hash>
- </item>
- <item key="addresses_default_ttl">5</item>
- <item key="smarthost">localhost</item>
<item key="my_localpart">pinger</item>
<item key="my_domain">marvin.palfrader.org</item>
- <item key="mailindir">mail/IN</item>
- <item key="mailerrordir">mail/ERROR</item>
- <item key="ping_new">1</item>
- <item key="show_new">0</item>
- <item key="pinger_interval">60</item>
- <item key="ping_every_nth_time">60</item>
<item key="Pinger::Mix">
<hash>
<item key="mixdir">/home/weasel/Mix</item>
<item key="mix">/home/weasel/Mix/mix</item>
</hash>
</item>
- <item key="resultdir">results</item>
- <item key="gnupghome">gnupg</item>
- <item key="tmpdir">tmp</item>
- <item key="prospective_addresses_ttl">432000</item> <!-- 5 days -->
- <item key="reliable_auto_add_min">3</item>
- <item key="commands">commands</item>
- <item key="pidfile">pingd.pid</item>
- <item key="expire_keys">432000</item> <!-- 5 days -->
- <item key="expire_confs">432000</item> <!-- 5 days -->
- <item key="expire_pings">1123200</item> <!-- 13 days -->
</hash>
</perldata>