Skip to content

Commit

Permalink
feature(worker): Allow configuring redis with a password
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed May 15, 2024
1 parent 9b5ef3a commit f64a5f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/docs/03-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The app is mainly configured by environment variables. All the used environment
| REDIS_HOST | Yes | localhost | The address of redis used by background jobs |
| REDIS_PORT | Yes | 6379 | The port of redis used by background jobs |
| REDIS_DB_IDX | No | Not set | The db idx to use with redis. It defaults to 0 (in the client) so you don't usually need to set it unless you explicitly want another db. |
| REDIS_PASSWORD | No | Not set | The password used for redis authentication. It's not required if your redis instance doesn't require AUTH. |
| MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |
| MEILI_MASTER_KEY | Only in Prod and if search is enabled | Not set | The master key configured for meilisearch. Not needed in development environment. Generate one with `openssl rand -base64 36` |
| DISABLE_SIGNUPS | No | false | If enabled, no new signups will be allowed and the signup button will be disabled in the UI |
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const allEnv = z.object({
REDIS_HOST: z.string().default("localhost"),
REDIS_PORT: z.coerce.number().default(6379),
REDIS_DB_IDX: z.coerce.number().optional(),
REDIS_PASSWORD: z.string().optional(),
CRAWLER_HEADLESS_BROWSER: stringBool("true"),
BROWSER_WEB_URL: z.string().url().optional(),
CRAWLER_JOB_TIMEOUT_SEC: z.coerce.number().default(60),
Expand Down Expand Up @@ -58,6 +59,7 @@ const serverConfigSchema = allEnv.transform((val) => {
redisHost: val.REDIS_HOST,
redisPort: val.REDIS_PORT,
redisDBIdx: val.REDIS_DB_IDX,
redisPassword: val.REDIS_PASSWORD,
},
crawler: {
numWorkers: val.CRAWLER_NUM_WORKERS,
Expand Down
1 change: 1 addition & 0 deletions packages/shared/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const queueConnectionDetails = {
host: serverConfig.bullMQ.redisHost,
port: serverConfig.bullMQ.redisPort,
db: serverConfig.bullMQ.redisDBIdx,
password: serverConfig.bullMQ.redisPassword,
};

// Link Crawler
Expand Down

0 comments on commit f64a5f3

Please sign in to comment.