()
| 22 | } |
| 23 | |
| 24 | export const getCacheConfig = (): RedisClientOptions => { |
| 25 | const password = process.env.REDIS_PASSWORD |
| 26 | |
| 27 | if (process.env.REDIS_URI) { |
| 28 | return { |
| 29 | url: process.env.REDIS_URI, |
| 30 | ...(password ? { password } : {}), |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | const host = process.env.REDIS_HOST |
| 35 | const port = process.env.REDIS_PORT |
| 36 | |
| 37 | if (password) { |
| 38 | const username = process.env.REDIS_USER ?? 'default' |
| 39 | |
| 40 | return { |
| 41 | url: `redis://${host}:${port}`, |
| 42 | username, |
| 43 | password, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | return { |
| 48 | url: `redis://${host}:${port}`, |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | let instance: CacheClient | undefined = undefined |
| 53 |
no outgoing calls
no test coverage detected