mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-08-28 11:46:02 +08:00
Add support for redis auth (#602)
This commit is contained in:
parent
33119ef1d3
commit
27a457b53a
4 changed files with 29 additions and 5 deletions
|
@ -73,6 +73,8 @@ export default (type?: EnvType): Env => {
|
|||
redis: {
|
||||
host: process.env.REDIS_HOST!,
|
||||
port: parseInt(process.env.REDIS_PORT!),
|
||||
username: process.env.REDIS_USERNAME,
|
||||
password: process.env.REDIS_PASSWORD,
|
||||
tls: process.env.REDIS_TLS === 'true',
|
||||
},
|
||||
queue: driver<QueueConfig>(process.env.QUEUE_DRIVER, {
|
||||
|
|
|
@ -3,14 +3,18 @@ import IORedis, { Redis } from 'ioredis'
|
|||
export interface RedisConfig {
|
||||
host: string
|
||||
port: number
|
||||
username?: string
|
||||
password?: string
|
||||
tls: boolean
|
||||
}
|
||||
|
||||
export const DefaultRedis = (config: RedisConfig, extraOptions = {}): Redis => {
|
||||
export const DefaultRedis = ({ port, host, username, password, tls }: RedisConfig, extraOptions = {}): Redis => {
|
||||
return new IORedis({
|
||||
port: config.port,
|
||||
host: config.host,
|
||||
tls: config.tls
|
||||
port,
|
||||
host,
|
||||
...username && { username },
|
||||
...password && { password },
|
||||
tls: tls
|
||||
? { rejectUnauthorized: false }
|
||||
: undefined,
|
||||
...extraOptions,
|
||||
|
|
|
@ -66,6 +66,9 @@ services:
|
|||
REDIS_HOST: ${REDIS_HOST}
|
||||
REDIS_PORT: ${REDIS_PORT}
|
||||
REDIS_TLS: ${REDIS_TLS}
|
||||
REDIS_CONCURRENCY: ${REDIS_CONCURRENCY}
|
||||
REDIS_USERNAME: ${REDIS_USERNAME}
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
AWS_SQS_QUEUE_URL: ${AWS_SQS_QUEUE_URL}
|
||||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
|
@ -135,6 +138,9 @@ services:
|
|||
REDIS_HOST: ${REDIS_HOST}
|
||||
REDIS_PORT: ${REDIS_PORT}
|
||||
REDIS_TLS: ${REDIS_TLS}
|
||||
REDIS_CONCURRENCY: ${REDIS_CONCURRENCY}
|
||||
REDIS_USERNAME: ${REDIS_USERNAME}
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
AWS_SQS_QUEUE_URL: ${AWS_SQS_QUEUE_URL}
|
||||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
|
|
|
@ -20,13 +20,25 @@ Find below a list of all environment variables that can be set at launch to conf
|
|||
### Queue
|
||||
| key | type | required |
|
||||
|--|--|--|
|
||||
| QUEUE_DRIVER | 'sqs' or 'memory' | true |
|
||||
| QUEUE_DRIVER | 'sqs' or 'redis' or 'memory' | true |
|
||||
| AWS_SQS_QUEUE_URL | string | If driver is SQS |
|
||||
| AWS_REGION | string | If driver is SQS |
|
||||
| AWS_ACCESS_KEY_ID | string | If driver is SQS |
|
||||
| AWS_SECRET_ACCESS_KEY | string | If driver is SQS |
|
||||
| REDIS_HOST | string | If driver is Redis |
|
||||
| REDIS_PORT | string | If driver is Redis |
|
||||
| REDIS_TLS | boolean | false |
|
||||
|
||||
|
||||
### Redis
|
||||
| key | type | required |
|
||||
|--|--|--|
|
||||
| REDIS_HOST | string | true |
|
||||
| REDIS_PORT | string | true |
|
||||
| REDIS_TLS | boolean | false |
|
||||
| REDIS_USERNAME | string | false |
|
||||
| REDIS_PASSWORD | string | false |
|
||||
|
||||
### Storage
|
||||
| key | type | required |
|
||||
|--|--|--|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue