feat(server): added keystore and made server cfg fetch from keystore to avoid db calls

This commit is contained in:
Akhil Mohan
2024-02-26 19:52:38 +05:30
parent 1cccbca0c5
commit 7d8b399102
9 changed files with 77 additions and 18 deletions
+13
View File
@@ -0,0 +1,13 @@
import { Redis } from "ioredis";
export type TKeyStoreFactory = ReturnType<typeof keyStoreFactory>;
export const keyStoreFactory = (redisUrl: string) => {
const redis = new Redis(redisUrl);
const setItem = async (key: string, value: string | number | Buffer) => redis.set(key, value);
const getItem = async (key: string) => redis.get(key);
return { setItem, getItem };
};