-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feature request: allow extra options for storage backends #40
Feature request: allow extra options for storage backends #40
Conversation
I think this looks ok |
@c00kiemon5ter I updated the code to your request. I agree that its best to handle this situation as most defaults appear to be None |
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
@@ -120,10 +136,21 @@ class RedisWrapper(StorageBase): | |||
Supports JSON-serializable data types. | |||
""" | |||
|
|||
def __init__(self, db_uri, collection, ttl=None): | |||
def __init__( | |||
self, db_uri, *, db_name=None, collection, ttl=None, extra_options=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: set all but the first arg to RedisWrapper to be keyword-only args.
Added db_name
as the redis db index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, the MongoWrapper and RedisWrapper initialization interfaces are the same.
(["mongodb://localhost/pyop"], {"collection": "test", "ttl": 3}), | ||
(["mongodb://localhost"], {"db_name": "pyop", "collection": "test"}), | ||
(["mongodb://localhost", "test", "pyop"], {}), | ||
(["mongodb://localhost/pyop", "test"], {}), | ||
(["mongodb://localhost/pyop"], {"db_name": "other", "collection": "test"}), | ||
(["redis://localhost/0"], {"db_name": "pyop", "collection": "test"}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db_name
is now valid for redis.
I would like to allow some way of supporting a TLS connection, specifying the certificates. This is a draft PR meant for discussion
Edit:
As it is about a RedisWrapper this solution is probably better: