dartis
dartis copied to clipboard
Should support connectionString containing password
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>();
Related: https://github.com/jcmellado/dartis/issues/23
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]);
}
I would love to see @cjdenio 's fix included.