-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: Add DynamoDB as a Bundled Store for Sessions #87
Conversation
Interesting stuff! |
Hello @7nohe The tests are failing on the CI. Can you please take a look why? |
Sure. It seems like we will probably need a DynamoDB local environment on the CI. |
@thetutlage |
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.
Looks neat!
src/define_config.ts
Outdated
config.keyAttribute, | ||
config.valueAttribute, | ||
config.expiresAtAttribute |
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.
Are there any legit reasons for allowing to customize the attribute names?
I get it provides flexibility, but if the names are hardcoded, do we have any downsides?
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.
@thetutlage
Since the keyAttribute
must be defined when creating a DynamoDB table, flexibility is necessary to allow it to be overwritten later.
As for the valueAttribute
and expiresAtAttribute
, to be honest, I canβt think of many cases where hardcoding them would cause issues.
I referred to Laravelβs implementation, and perhaps there may be cases where you want to share the session table with an already existing application.
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.
Sure. So let's hardcode valueAttribute
and the expiresAtAttribute
attribute and let's see how it goes. We can always make them attributes configurable later.
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.
@thetutlage
I have hardcoded the valueAttribute
and expiresAtAttribute
. I have also updated the documentation.
I have created this PR which will fix failing tests unrelated to your PR. 7nohe#3 |
tests: fix tests to be more resillient with core changes
Merged! |
Thanks a ton @7nohe for taking out time and working on it. I will cut a release in coming days and will notify you |
@thetutlage |
π Linked issue
https://github.com/orgs/adonisjs/discussions/4710
β Type of change
π Description
Added DynamoDB as a bundled store option for session management.
In order to use this option, you need to prepare a DynamoDB table, and session data is read and written using the DynamoDB client.
For testing, I have used DynamoDB Local.
Additionally, I have prepared a demo application that uses DynamoDB as a store for sessions.
You cannot try the real DynamoDB server without creating an AWS account, but this repository includes code that creates a DynamoDB table just by running AWS CDK. You should be able to try it right away by simply creating an IAM user to execute the cdk deploy command.
Here is the Laravel code I used as a reference for the implementation.
https://github.com/laravel/framework/blob/11.x/src/Illuminate/Cache/DynamoDbStore.php
π Checklist