tethys.backend/config/redis.ts

36 lines
1013 B
TypeScript
Raw Normal View History

2024-03-14 19:25:27 +00:00
import env from '#start/env'
import { defineConfig } from '@adonisjs/redis'
import { InferConnections } from '@adonisjs/redis/types'
2024-03-14 19:25:27 +00:00
const redisConfig = defineConfig({
connection: 'main',
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.
|
*/
2024-03-14 19:25:27 +00:00
main: {
host: env.get('REDIS_HOST'),
port: env.get('REDIS_PORT'),
password: env.get('REDIS_PASSWORD', ''),
db: 0,
keyPrefix: '',
2024-03-14 19:25:27 +00:00
retryStrategy(times) {
return times > 10 ? null : times * 50
},
},
},
})
2024-03-14 19:25:27 +00:00
export default redisConfig
declare module '@adonisjs/redis/types' {
export interface RedisConnections extends InferConnections<typeof redisConfig> {}
}