fpavon-ee-shared 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,13 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
|
17
17
|
const connection_sql_1 = require("../bd/connection.sql"); // Asegúrate de ajustar la ruta a tu configuración de base de datos
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
19
|
function getSecret() {
|
|
20
|
-
|
|
20
|
+
const secret = process.env.SECRET;
|
|
21
|
+
if (!secret) {
|
|
22
|
+
// Lanza un error para detener la ejecución si no está configurada
|
|
23
|
+
console.error("ERROR: La variable de entorno 'SECRET' no está configurada.");
|
|
24
|
+
throw new Error("SECRET_NOT_CONFIGURED");
|
|
25
|
+
}
|
|
26
|
+
return secret;
|
|
21
27
|
}
|
|
22
28
|
const asyncHandlerWrapper = (req, res, next) => {
|
|
23
29
|
// Asume que 'fn' es tu función asíncrona original (la que tiene el Promise<void>)
|
|
@@ -3,8 +3,16 @@ import jwt from 'jsonwebtoken';
|
|
|
3
3
|
import { getConnection } from '../bd/connection.sql'; // Asegúrate de ajustar la ruta a tu configuración de base de datos
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
|
|
6
|
-
function getSecret(){
|
|
7
|
-
|
|
6
|
+
function getSecret(): string {
|
|
7
|
+
const secret = process.env.SECRET;
|
|
8
|
+
|
|
9
|
+
if (!secret) {
|
|
10
|
+
// Lanza un error para detener la ejecución si no está configurada
|
|
11
|
+
console.error("ERROR: La variable de entorno 'SECRET' no está configurada.");
|
|
12
|
+
throw new Error("SECRET_NOT_CONFIGURED");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return secret;
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
const asyncHandlerWrapper: RequestHandler = (req: Request, res: Response, next: NextFunction) => {
|