diff --git a/.circleci/config.yml b/.circleci/config.yml index 99d9dadec..fa497104e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/README.md b/README.md index 428fbf930..28d959791 100644 --- a/README.md +++ b/README.md @@ -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`) diff --git a/src/core/server/config.ts b/src/core/server/config.ts index b4bbd7f66..94affb87e 100644 --- a/src/core/server/config.ts +++ b/src/core/server/config.ts @@ -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.", diff --git a/src/core/server/services/redis/index.ts b/src/core/server/services/redis/index.ts index 0f0ab7fea..38c0f91af 100644 --- a/src/core/server/services/redis/index.ts +++ b/src/core/server/services/redis/index.ts @@ -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, });