GuardianDb Redis Repo
- You need to add
:redix
and:jason
to your project to make this Redis "Repo" working for your Guardian.DB
in your mix.exs
file:
{:redix, ">= 0.0.0"},
{:jason, "~> 1.0"},
and create a config:
config :my_app, :redis,
host: {:system, "REDIS_HOST"},
port: {:system, "REDIS_PORT"}
-
Create
MyApp.Redix
module in yourlib/
directory. This is pool of Redix workers, just to be sure you'll not face GenServer bottleneck.Apart from that, don't forget to add
MyApp.Redix
to yourapplication.ex
file as a child to your Supervisor so it will be started when your project starts.
children = [
...
MyApp.Redix,
...
]
- Update your
config/config.exs
file withGuardian.DB
config:
config :guardian, Guardian.DB,
repo: Guardian.DB.Repo.Redis
You're done! Now your Guardian tokens are stored in Redis.