forked from adonisjs/redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
37 lines (33 loc) · 852 Bytes
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* @adonisjs/redis
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { RedisConnectionConfig, RedisClusterConfig } from '@ioc:Adonis/Addons/Redis'
/**
* Expected shape of the config accepted by the "redisConfig"
* method
*/
type RedisConfig = {
connections: {
[name: string]: RedisConnectionConfig | RedisClusterConfig
}
}
/**
* Define config for redis
*/
export function redisConfig<T extends RedisConfig & { connection: keyof T['connections'] }>(
config: T
): T {
return config
}
/**
* Pull connections from the config defined inside the "config/redis.ts"
* file
*/
export type InferConnectionsFromConfig<T extends RedisConfig> = {
[K in keyof T['connections']]: T['connections'][K]
}