mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
[next] Add redis_options config (#2323)
* [next] Add redis_options config * fix: updated docs, camelcased arg, used native merge * fix: improved CI issues
This commit is contained in:
committed by
Wyatt Johnson
parent
e7151806ea
commit
7beab6419e
@@ -1,6 +1,8 @@
|
||||
# job_environment will setup the environment for any job being executed.
|
||||
job_environment: &job_environment
|
||||
NODE_ENV: test
|
||||
WEBPACK_MAX_CORES: 2
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
|
||||
# job_defaults applies all the defaults for each job.
|
||||
job_defaults: &job_defaults
|
||||
|
||||
@@ -239,6 +239,9 @@ the variables in a `.env` file in the root of the project in a simple
|
||||
(Default `mongodb://127.0.0.1:27017/coral`)
|
||||
- `REDIS_URI` - The Redis database URI to connect to.
|
||||
(Default `redis://127.0.0.1:6379`)
|
||||
- `REDIS_OPTIONS` - A JSON string with optional configuration options to be used
|
||||
when connecting to Redis as specified in the [ioredis](https://github.com/luin/ioredis/blob/1dac50a63753c2afc969315cfe38faf0edc50bc5/API.md#new_Redis_new) documentation.
|
||||
(Default: `{}`)
|
||||
- `SIGNING_SECRET` - The shared secret to use to sign JSON Web Tokens (JWT) with
|
||||
the selected signing algorithm. 🚨 **Don't forget to set this variable!** 🚨
|
||||
(Default: `keyboard cat`)
|
||||
|
||||
@@ -126,6 +126,13 @@ const config = convict({
|
||||
arg: "redis",
|
||||
sensitive: true,
|
||||
},
|
||||
redis_options: {
|
||||
doc: "The Redis options to connect to Redis Server.",
|
||||
format: Object,
|
||||
default: {},
|
||||
env: "REDIS_OPTIONS",
|
||||
arg: "redisOptions",
|
||||
},
|
||||
signing_secret: {
|
||||
doc:
|
||||
"The shared secret to use to sign JSON Web Tokens (JWT) with the selected signing algorithm.",
|
||||
|
||||
@@ -42,7 +42,12 @@ export function createRedisClient(
|
||||
lazyConnect: boolean = false
|
||||
): Redis {
|
||||
try {
|
||||
const options = config.get("redis_options") || {};
|
||||
|
||||
const redis = new RedisClient(config.get("redis"), {
|
||||
// Merge in the custom options.
|
||||
...options,
|
||||
// Enforce the lazyConnect option as provided by the function invocation.
|
||||
lazyConnect,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user