Rename 'redis_server' arg to 'redis'
This commit is contained in:
parent
4f9af75e48
commit
462a2ae367
@ -104,7 +104,7 @@ usable directory from the following list will be used:
|
||||
|
||||
=back
|
||||
|
||||
=head2 redis_server <host[:port]>
|
||||
=head2 redis <host[:port]>
|
||||
|
||||
Location of redis server where the greylisting DB will be stored.
|
||||
|
||||
@ -179,7 +179,7 @@ my $VERSION = '0.12';
|
||||
|
||||
my $DENYMSG = "This mail is temporarily denied";
|
||||
my %PERMITTED_ARGS = map { $_ => 1 } qw(per_recipient remote_ip sender
|
||||
recipient black_timeout white_timeout deny_late db_dir redis_server
|
||||
recipient black_timeout white_timeout deny_late db_dir redis
|
||||
nfslock p0f reject loglevel geoip upgrade );
|
||||
$PERMITTED_ARGS{grey_timeout} = 1; # Legacy argument now ignored
|
||||
|
||||
@ -233,7 +233,7 @@ sub register_hooks {
|
||||
|
||||
sub init_db {
|
||||
my ($self) = @_;
|
||||
return $self->init_redis if $self->{_args}{redis_server};
|
||||
return $self->init_redis if $self->{_args}{redis};
|
||||
return $self->init_dbm;
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ sub init_redis {
|
||||
|
||||
sub parse_redis_server {
|
||||
my ($self) = @_;
|
||||
my $server = $self->{_args}{redis_server};
|
||||
my $server = $self->{_args}{redis};
|
||||
return $server if $server =~ /:/;
|
||||
return "$server:6379";
|
||||
}
|
||||
|
@ -285,27 +285,27 @@ sub rc {
|
||||
sub test_init_redis {
|
||||
my ($self) = @_;
|
||||
delete $self->{db};
|
||||
$self->{_args}{redis_server} = 'bogusserverasdfqwerty.:6379';
|
||||
$self->{_args}{redis} = 'bogusserverasdfqwerty.:6379';
|
||||
ok( ! $self->init_redis, 'init_redis() fails on bogus server' );
|
||||
eval { Qpsmtpd::DB::Redis->new };
|
||||
return if $@;
|
||||
$self->{_args}{redis_server} = 'localhost';
|
||||
$self->{_args}{redis} = 'localhost';
|
||||
ok( $self->init_redis, 'init_redis() succeeds when redis is up' );
|
||||
}
|
||||
|
||||
sub test_init_dbm {
|
||||
my ($self) = @_;
|
||||
delete $self->{db};
|
||||
delete $self->{_args}{redis_server};
|
||||
delete $self->{_args}{redis};
|
||||
ok( $self->init_db, 'init_db() works for DBM' );
|
||||
}
|
||||
|
||||
sub test_parse_redis_server {
|
||||
my ($self) = @_;
|
||||
$self->{_args}{redis_server} = 'asdf:1234';
|
||||
$self->{_args}{redis} = 'asdf:1234';
|
||||
is( $self->parse_redis_server, 'asdf:1234',
|
||||
'parse_redis_server(): leave provided port alone' );
|
||||
$self->{_args}{redis_server} = 'qwerty';
|
||||
$self->{_args}{redis} = 'qwerty';
|
||||
is( $self->parse_redis_server, 'qwerty:6379',
|
||||
'parse_redis_server(): add default port' );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user