Fix: No more type casting required, rather take the gernics

This commit is contained in:
Diego Magdaleno
2021-05-23 13:43:38 -05:00
parent 69fce77aef
commit 28424ed950
14 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc
try {
const { jwtSecret } = (Config.apiConfig.getAll() as Config.DefaultOptions).security;
const { jwtSecret } = Config.apiConfig.getAll().security;
const decoded: any = await checkToken(req.headers.authorization, jwtSecret);
+1 -1
View File
@@ -44,7 +44,7 @@ export async function GlobalRateLimit(req: Request, res: Response, next: NextFun
}
export function getIpAdress(req: Request): string {
const { forwadedFor } = (Config.apiConfig.getAll() as Config.DefaultOptions).security;
const { forwadedFor } = Config.apiConfig.getAll().security;
const ip = forwadedFor ? <string>req.headers[forwadedFor] : req.ip;
return ip.replaceAll(".", "_").replaceAll(":", "_");
}