Fix: No more type casting required, rather take the gernics
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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(":", "_");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user