support for remote redis server, AUTH

This commit is contained in:
Al Beano 2016-07-06 14:56:00 +01:00
parent c0759152ce
commit 3fdd46bc6b
3 changed files with 13 additions and 2 deletions

View File

@ -7,13 +7,21 @@ use warnings;
our @EXPORT = qw(redis); our @EXPORT = qw(redis);
use Redis; use Redis;
use FindBin qw($Bin);
use lib $Bin;
use MarkovBot::Config;
sub redis() { sub redis() {
# Returns a redis object # Returns a redis object
# This is fairly useless but in the future could be used to # This is fairly useless but in the future could be used to
# pass specific options to redis. # pass specific options to redis.
#
# TODO: support connection to redis via a socket
return Redis->new(); return new Redis (
server => config("redis_server"),
password => (config("redis_usepass") eq "true") ? config("redis_password") : undef,
);
} }
1; 1;

View File

@ -9,7 +9,7 @@ The original shithead uses far too much ram and is badly implemented.
Let's reimplement it and get redis to do all the heavy lifting. Let's reimplement it and get redis to do all the heavy lifting.
## Getting Started ## Getting Started
First, set up dependencies. You need a redis server running locally (currently, AUTH and remote servers are not supported, this will be supported in the future) and the necessary perl modules: First, set up dependencies. You need a redis server and the necessary perl modules:
```bash ```bash
# install cpanminus with your package manager of choice (preferred), or install it through cpan: # install cpanminus with your package manager of choice (preferred), or install it through cpan:

View File

@ -8,6 +8,9 @@ insult: "you're a faggot"
# Redis Settings # Redis Settings
# #
redis_prefix: markov redis_prefix: markov
redis_server: 127.0.0.1:6379
redis_usepass: false
redis_password: hunter2
# #
# IRC Settings # IRC Settings