redis-sync icon indicating copy to clipboard operation
redis-sync copied to clipboard

Support for Redis connections that require auth? Parse args into strings/json?

Open aliasone opened this issue 12 years ago • 4 comments

Would it be possible to support redis connections that need auth by allowing credentials to be passed into redis-sync?

Also, is it possible to parse the key being acted into a string on from the args? And parsing the data being set into a string/object from the args?

Thanks for the cool lib!

aliasone avatar May 21 '12 16:05 aliasone

Hi aliasone, thanks for your suggestions and for your interest in redis-sync.

Regarding auth support, that's something I've been meaning to add at some point. It hasn't been a priority as I haven't had a need for it myself yet and nobody had requested it so far. But you can now expect it in the next release.

I've been also pondering over whether to decode key names and values. Currently you get raw buffers and need to decode yourself. I absolutely want to keep the flexibility of passing raw buffers - for binary data - but almost all the use cases I've seen end up treating at least the key name as a string, so some kind of option to decode would make redis-sync (and rdb-parser) easier to use. So that's another one for the next release.

pconstr avatar May 21 '12 20:05 pconstr

Awesome, yes this would make redis-sync a perfect fit for what I'd like to use it for.

Edit: Oh, I also didn't know buffers had a toString() method. That simplifies things a bit.

Thanks!

aliasone avatar May 21 '12 23:05 aliasone

you also need to concatenate the buffers. note that you get passed an array of buffers rather than just a buffer

require("bufferjs"); // there are other libraries out there for this, I tend to use this one sync.on('command', function(command, args) { var key = Buffer.concat(args[0]).toString(); });

if you just use args[0].toString() it will work for the fairly common case of a array with a single Buffer, but you will end up with mysterious commas in the middle of the string now and then

pconstr avatar May 22 '12 04:05 pconstr

just made a quick npm release to fix urgent issues on OS X with node.js 0.8.x this comes next

pconstr avatar Jul 26 '12 16:07 pconstr