Redis URL scheme is not supported, redis://<user>:<password>@<host>:<port>
Hello, I'm having trouble getting the client to connect to Redis. Here is a rough reproducer:
use Redis;
my $r = Redis->new(server => $ENV{REDIS_URL});
My Redis URL is in this format: redis://<user>:<password>@<host>:<port>. That's the same as the schema described here: http://www.iana.org/assignments/uri-schemes/prov/redis.
When I try to connect, I get the error "Could not connect to Redis server at <my url>: Invalid argument".
I was able to connect with this URL schema using py-redis:
r = redis.from_url(os.environ.get('REDIS_URL'))
Help please! :D
If anybody else runs into this issue in the future, the workaround I went with was breaking the Redis URL up into parts using URI::redis, and then supplying each argument seperately to the constructor.
Like so:
use Redis;
use URI::redis;
my $uri = URI->new($ENV{REDIS_URL});
my $redis = Redis->new(
server => $uri->host . ':' . $uri->port,
password => $uri->password,
);
I also brought up the idea of integrating the redis URL scheme into the base URI module: https://github.com/libwww-perl/URI/issues/119.
It would still be cool for perl-redis to natively understand this Redis URL scheme though.
I like this idea and I'd like to try contributing to public Perl code for the first time, so I'm going to try to implement this. @joshnatis would you mind if I pinged you if I run into issues or to try it out when I think it's ready?
@davmillar that's awesome! Sure thing, happy to help -- I'll await your comment