-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for creating regex- and subnet-based ReadFrom instances from a single string #3013
Comments
If you need assistance with this issue, I can create a PR. The implementation is already completed in my branch, but I'm waiting for the team's decision on whether to move forward with this enhancement. |
PRs are welcome, especially if you already have a suggestion. |
Would you consider adding support for the following formats as well? |
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
PR has been created. |
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in underscore format
Let's discuss this in the PR |
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in kebab-case format
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf for subnet and regex types. This commit introduces support for these types, as well as the use of names in snake_case, kebab-case formats
…om a single string redis#3013 Before this commit, it was not possible to use ReadFrom.valueOf(name) for subnet and regex types. This commit introduces a new syntax subnet:192.168.0.0/16,2001:db8:abcd:0000::/52 and regex:.*region-1.* respectively
Feature Request
Spring Boot would like to be able to offer support for configuring Lettuce's
ReadFrom
setting using an application property. This is straightforward for the manyReadFrom
constants that are supported byReadFrom#valueOf
but harder for theregex
andsubnet
variants. We'd like to make this easier by enhancingvalueOf
to supportregex
andsubnet
as well.Is your feature request related to a problem? Please describe
Please see spring-projects/spring-boot#42588 for background and a description of the problem we're currently facing with trying to configure the
regex
andsubnet
variants with a single property.Describe the solution you'd like
Our proposal is to enhance
valueOf
with support for a special syntax that allow the caller to indicate that aregex
orsubnet
instance should be created and to provide the patterns or CIDR notations at the same time. The variant would be indicated by a prefix such asregex:
orsubnet:
with the remainder of the string being the value. For example,"regex:.*region-1.*"
or"subnet:192.168.0.0/16"
. Comma-separated values could be supported as well such as"subnet:192.168.0.0/16,2001:db8:abcd:0000::/52"
.Supporting an order-sensitive
regex
hasn't really been considered yet. Perhaps anorder-sensitive-regex
would be the cleanest option?Describe alternatives you've considered
We've considered defining this syntax in Spring Boot and pre-processing the value before calling
ReadFrom#pattern
orReadFrom#subnet
as appropriate. We concluded that it would be better for Lettuce itself to support the syntax as it broadens the benefit and also means that Spring Boot won't be an odd-on-out with a feature that may clash with a future change in Lettuce.Teachability, Documentation, Adoption, Migration Strategy
Users will be able to call
ReadFrom#valueOf
and create any of the supported variants if they pass in an appropriately formatted string. No migration would be required as I would expect the existingsubnet
andregex
methods to remain for those who prefer not to use a "magic" string.The text was updated successfully, but these errors were encountered: