Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
✨ Add redis queue prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Feb 29, 2020
1 parent ee0cd22 commit 76403fc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staart/manager",
"version": "1.3.43",
"version": "1.3.44",
"main": "index.js",
"repository": "[email protected]:staart/api.git",
"author": "Anand Chowdhary <[email protected]>",
Expand Down Expand Up @@ -125,5 +125,5 @@
"setup"
],
"snyk": true,
"staart-version": "1.3.43"
"staart-version": "1.3.44"
}
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export const DB_PASSWORD = process.env.DB_PASSWORD || "";
export const DB_DATABASE = process.env.DB_DATABASE || "database";
export const DB_TABLE_PREFIX = process.env.DB_TABLE_PREFIX || "";

// Redis
export const REDIS_URL = process.env.REDIS_URL || "";
export const REDIS_QUEUE_PREFIX = process.env.REDIS_QUEUE_PREFIX || "staart-";

// Caching
export const CACHE_TTL = process.env.CACHE_TTL
? parseInt(process.env.CACHE_TTL)
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/elasticsearch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { elasticSearch } from "@staart/elasticsearch";
import { redisQueue } from "@staart/redis";
import { logError } from "@staart/errors";
import { REDIS_QUEUE_PREFIX } from "../config";

const ELASTIC_QUEUE = "es-records";
const ELASTIC_QUEUE = `${REDIS_QUEUE_PREFIX}es-records`;

let queueSetup = false;
const setupQueue = async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/mail.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FRONTEND_URL } from "../config";
import { FRONTEND_URL, REDIS_QUEUE_PREFIX } from "../config";
import { readFile } from "fs-extra";
import { join } from "path";
import i18n from "../i18n";
Expand All @@ -7,7 +7,7 @@ import { render } from "@staart/mustache-markdown";
import { redisQueue } from "@staart/redis";
import { logError } from "@staart/errors";

const MAIL_QUEUE = "outbound-emails";
const MAIL_QUEUE = `${REDIS_QUEUE_PREFIX}outbound-emails`;

let queueSetup = false;
const setupQueue = async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
import { Webhook } from "../interfaces/tables/organization";
import { createHmac } from "crypto";
import axios from "axios";
import { JWT_ISSUER } from "../config";
import { JWT_ISSUER, REDIS_QUEUE_PREFIX } from "../config";
import { redisQueue } from "@staart/redis";
import { logError } from "@staart/errors";

const WEBHOOK_QUEUE = "webhooks";
const WEBHOOK_QUEUE = `${REDIS_QUEUE_PREFIX}webhooks`;

let queueSetup = false;
const setupQueue = async () => {
Expand Down

0 comments on commit 76403fc

Please sign in to comment.