diff --git a/MarkovBot/Redis.pm b/MarkovBot/Redis.pm index 6af3716..7760ae8 100644 --- a/MarkovBot/Redis.pm +++ b/MarkovBot/Redis.pm @@ -7,13 +7,21 @@ use warnings; our @EXPORT = qw(redis); use Redis; +use FindBin qw($Bin); +use lib $Bin; +use MarkovBot::Config; sub redis() { # Returns a redis object # This is fairly useless but in the future could be used to # 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; diff --git a/README.md b/README.md index 95cbb27..7de3ce6 100644 --- a/README.md +++ b/README.md @@ -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. ## 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 # install cpanminus with your package manager of choice (preferred), or install it through cpan: diff --git a/config.default.yml b/config.default.yml index e886432..4887c5b 100644 --- a/config.default.yml +++ b/config.default.yml @@ -8,6 +8,9 @@ insult: "you're a faggot" # Redis Settings # redis_prefix: markov +redis_server: 127.0.0.1:6379 +redis_usepass: false +redis_password: hunter2 # # IRC Settings