arghmeleg / goldfish

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hex.pm VersionLicense badge

Goldfish

Goldfish is a database session store that implements the Plug.Session.Store behavior.

Installation

  1. Goldfish can be installed by adding goldfish to your list of dependencies in mix.exs:
def deps do
  [
    {:goldfish, "~> 0.1.0"}
  ]
end
  1. Edit your endpoint file (for example lib/my_app_web/endpoint.ex) and change store to use Goldfish.Store
plug Plug.Session,
  store: Goldfish.Store,
  key: "_my_app_key"
  1. Configure Goldfish (for example in config/config.exs) to use your repo of choice to store your user sessions
config :goldfish,
  repo: MyApp.Repo
  1. Generate the migration to create your session table and migrate your databse
mix goldfish

You should see this output

* creating priv/repo/migrations/20191224004432_goldfish_sessions.exs

Then migrate your database to create the table

mix ecto.migrate

That's it! You're ready to start using Goldfish to store your user sessions.

About

License:MIT License


Languages

Language:Elixir 100.0%