Merge branch 'dev' into feat/um-114-roles-and-permissions

This commit is contained in:
Brian Cao 2022-12-01 20:30:46 -08:00
parent 3085bdd713
commit ab9f403448
28 changed files with 345 additions and 412 deletions

View file

@ -3,16 +3,18 @@ import debug from 'debug';
const log = debug('umami:redis');
const REDIS = Symbol();
const DELETED = 'DELETED';
let redis;
const enabled = Boolean(process.env.REDIS_URL);
const url = process.env.REDIS_URL;
const enabled = Boolean(url);
async function getClient() {
if (!process.env.REDIS_URL) {
if (!enabled) {
return null;
}
const client = createClient({ url: process.env.REDIS_URL });
const client = createClient({ url });
client.on('error', err => log(err));
await client.connect();
@ -59,4 +61,4 @@ async function connect() {
return redis;
}
export default { enabled, client: redis, log, connect, get, set, del };
export default { enabled, client: redis, log, connect, get, set, del, DELETED };