imperugo / StackExchange.Redis.Extensions

MIT License
607 stars 177 forks source link

RedisConfiguration missing the User property #513

Closed WillGoGithub closed 1 year ago

WillGoGithub commented 1 year ago

Describe the bug According to this page StackExchange.Redis/Configuration there should have property "User" in the StackExchange.Redis.Extensions.Core.Configuration.RedisConfigService but not.

image

When redis server use ACL configured, would cause unable to connect.

To Reproduce services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get());

{
  "Redis": {
    "User": "username",
    "Password": "******",
    "Hosts": [
      {
        "Host": "******",
        "Port": "6379"
      }
    ]
  }
}

Expected behavior Class RedisConfiguration can take property of "User" and join it into connection string.

Desktop (please complete the following information):

Additional context Let me know I'm wrong if I miss something.

Thanks.

WillGoGithub commented 1 year ago

Hi,

We need to give up use ACL then access by root (no need username) with password.

I know that's not solution, and seems this package not update any more (latest is 2020).

I'am evaluating switch to use https://nishanc.medium.com/redis-as-a-distributed-cache-on-net-6-0-949ef5b795ee

Will Lai

jignesh-mpc91 @.***> 於 2022年11月4日 週五 下午6:57寫道:

@WillGoGithub https://github.com/WillGoGithub I think we have the same problem https://github.com/imperugo/StackExchange.Redis.Extensions/issues/514. Did you find the solution?

— Reply to this email directly, view it on GitHub https://github.com/imperugo/StackExchange.Redis.Extensions/issues/513#issuecomment-1303258646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5W423JXIJL3EAYPG4QJC3WGTTYFANCNFSM6AAAAAARMGXCZI . You are receiving this because you were mentioned.Message ID: @.***>

Avihailev commented 1 year ago

have you tried using ConfigurationOptions inside of RedisConfiguration ?

imperugo commented 1 year ago

Hi @WillGoGithub sorry for the delay. For do what you want to do there are different ways:

1) Use the connection string instead of the RedisConfiguration class. This allow you to specify all the parameters the main library (StackExhange.Redis) offers

2) Use the ConfigurationOptions as suggested by @Avihailev

3) Open a PR with the code, the tests and all the code you think is important for this library and I'll be happy to see it and merge if ok.

Finally, I just pushed the 9.0.1 that includes that parameter User into the RedisConfiguration so you have also the option 4 (but number 3 is still my favourite)

Thanks