mirror of
https://github.com/seejohnrun/haste-server.git
synced 2024-11-01 11:31:22 +00:00
Fix redis store
This commit is contained in:
parent
bf6795aa8b
commit
82fd0654e2
2 changed files with 14 additions and 2 deletions
|
@ -30,10 +30,20 @@ class RedisDocumentStore implements Store {
|
||||||
connect = (options: RedisStoreConfig) => {
|
connect = (options: RedisStoreConfig) => {
|
||||||
winston.info('configuring redis')
|
winston.info('configuring redis')
|
||||||
|
|
||||||
const url = process.env.REDISTOGO_URL || options.url || 'redis://redis:6379'
|
const url = process.env.REDISTOGO_URL || options.url
|
||||||
|
const host = options.host || '127.0.0.1'
|
||||||
|
const port = options.port || 6379
|
||||||
const index = options.db || 0
|
const index = options.db || 0
|
||||||
|
|
||||||
|
const connectionParameters = url ? {
|
||||||
|
url
|
||||||
|
}: {
|
||||||
|
host,
|
||||||
|
port
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
url,
|
...connectionParameters,
|
||||||
database: index as number,
|
database: index as number,
|
||||||
...(options.username ? { username: options.username } : {}),
|
...(options.username ? { username: options.username } : {}),
|
||||||
...(options.password ? { username: options.username } : {}),
|
...(options.password ? { username: options.username } : {}),
|
||||||
|
|
|
@ -56,6 +56,8 @@ export interface RedisStoreConfig extends BaseStoreConfig {
|
||||||
user?: string
|
user?: string
|
||||||
username?: string | undefined
|
username?: string | undefined
|
||||||
password?: string
|
password?: string
|
||||||
|
host?: string
|
||||||
|
port?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GoogleStoreConfig = BaseStoreConfig
|
export type GoogleStoreConfig = BaseStoreConfig
|
||||||
|
|
Loading…
Reference in a new issue