Refactor infisical-node to config file for birds eye view of envars

This commit is contained in:
Tuan Dang
2023-03-15 00:09:40 +07:00
parent 31111fc63b
commit a6c8638345
33 changed files with 264 additions and 262 deletions
+2 -2
View File
@@ -1,5 +1,4 @@
import * as Sentry from '@sentry/node';
import infisical from 'infisical-node';
import { Types } from 'mongoose';
import { TokenData } from '../models';
import crypto from 'crypto';
@@ -11,6 +10,7 @@ import {
TOKEN_EMAIL_PASSWORD_RESET
} from '../variables';
import { UnauthorizedRequestError } from '../utils/errors';
import { getSaltRounds } from '../config';
/**
* Create and store a token in the database for purpose [type]
@@ -84,7 +84,7 @@ const createTokenHelper = async ({
const query: TokenDataQuery = { type };
const update: TokenDataUpdate = {
type,
tokenHash: await bcrypt.hash(token, parseInt(infisical.get('SALT_ROUNDS')!) || 10),
tokenHash: await bcrypt.hash(token, getSaltRounds()),
expiresAt
}