mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-24 08:40:26 +01:00
Store token store from db to redis
This commit is contained in:
@@ -114,9 +114,8 @@ const authConfig: AuthConfig = {
|
||||
*/
|
||||
tokenProvider: {
|
||||
type: 'api',
|
||||
driver: 'database',
|
||||
table: 'api_tokens',
|
||||
foreignKey: 'user_id',
|
||||
driver: 'redis',
|
||||
redisConnection: 'local'
|
||||
},
|
||||
|
||||
provider: {
|
||||
|
||||
49
config/redis.ts
Normal file
49
config/redis.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Config source: https://git.io/JemcF
|
||||
*
|
||||
* Feel free to let us know via PR, if you find something broken in this config
|
||||
* file.
|
||||
*/
|
||||
|
||||
import Env from '@ioc:Adonis/Core/Env'
|
||||
import { RedisConfig } from '@ioc:Adonis/Addons/Redis'
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Following is the configuration used by the Redis provider to connect to
|
||||
| the redis server and execute redis commands.
|
||||
|
|
||||
| Do make sure to pre-define the connections type inside `contracts/redis.ts`
|
||||
| file for AdonisJs to recognize connections.
|
||||
|
|
||||
| Make sure to check `contracts/redis.ts` file for defining extra connections
|
||||
*/
|
||||
const redisConfig: RedisConfig = {
|
||||
connection: Env.get('REDIS_CONNECTION'),
|
||||
|
||||
connections: {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The default connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The main connection you want to use to execute redis commands. The same
|
||||
| connection will be used by the session provider, if you rely on the
|
||||
| redis driver.
|
||||
|
|
||||
*/
|
||||
local: {
|
||||
host: Env.get('REDIS_HOST'),
|
||||
port: Env.get('REDIS_PORT'),
|
||||
password: Env.get('REDIS_PASSWORD', ''),
|
||||
db: Env.get('REDIS_DB', 0),
|
||||
keyPrefix: 'athena:',
|
||||
healthCheck: true
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default redisConfig
|
||||
Reference in New Issue
Block a user