dartis icon indicating copy to clipboard operation
dartis copied to clipboard

Should support connectionString containing password

Open yelliver opened this issue 5 years ago • 3 comments

Instead of this:

    final client = await Client.connect('redis://myredis:8889');
    final commands = client.asCommands<String, String>();
    await commands.auth('password');

it is more elegant to do this:

    final client = await Client.connect('redis://username:password@myredis:8889');
    final commands = client.asCommands<String, String>();

yelliver avatar Jul 23 '20 13:07 yelliver

Related: https://github.com/jcmellado/dartis/issues/23

jcmellado avatar Jul 23 '20 15:07 jcmellado

This would definitely be helpful when working with Heroku Redis, where the password is passed to the client via a connection string.

Here's what I ended up using to get around it, if it helps anyone:

client = await Client.connect(Platform.environment["REDIS_URL"]);

var user = Uri.parse(Platform.environment["REDIS_URL"]).userInfo;
if (user != "") {
  await client.asCommands<String, String>().auth(user.split(":")[1]);
}

cjdenio avatar Sep 12 '20 16:09 cjdenio

I would love to see @cjdenio 's fix included.

kevinelliott avatar Feb 16 '21 04:02 kevinelliott