Marten DB Session provides a database session store for the Marten web framework.
Simply add the following entry to your project's shard.yml:
dependencies:
marten_db_session:
github: martenframework/marten-db-sessionAnd run shards install afterward.
Once installed you can configure your project to use the database session store by following these steps:
First, add the following requirement to your project's src/project.cr file:
require "marten_db_session"Secondly, add the following requirement to the top-level manage.cr file in order to make Marten DB Session Store migrations available to your project:
require "marten_db_session/cli"Then, add the MartenDBSession::App app class to your project's installed_apps setting and ensure that your sessions.store setting is set to :db:
Marten.configure do |config|
# Other settings...
config.installed_apps = [
MartenDBSession::App,
# Other apps..
]
config.sessions.store = :db
endFinally, run the marten migrate command in order to install the DB session entry model.
Congrats! You’re in! From now on, your session data will be persisted in a marten_db_session_store_entry table.
Morgan Aubert (@ellmetha) and contributors.
MIT. See LICENSE for more details.