2026-02-16 17:31:20 +01:00
|
|
|
/**
|
|
|
|
|
* !Importate
|
|
|
|
|
* Configuración unicamente para lanzar los test, este código no debe de ejecutarse
|
|
|
|
|
* en produccion
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { env, loadEnvFile } from "node:process";
|
|
|
|
|
import { Pool } from "pg";
|
|
|
|
|
import { PgClient } from "../infrastructure/PgClient.js";
|
2026-04-07 13:20:31 +02:00
|
|
|
import { HttpClient } from "../infrastructure/HTTPClient.js";
|
|
|
|
|
import { jwtService } from "./jwtService.config.js";
|
2026-02-16 17:31:20 +01:00
|
|
|
|
|
|
|
|
console.warn("[i!] Se está corriendo codigo de test")
|
|
|
|
|
loadEnvFile("../../.env") // Global
|
2026-04-07 13:20:31 +02:00
|
|
|
loadEnvFile("./test.env") // Local
|
2026-02-16 17:31:20 +01:00
|
|
|
|
|
|
|
|
// se hace una por servicio.
|
|
|
|
|
export const pgPool = new Pool({
|
|
|
|
|
user: env.POSTGRES_USER,
|
|
|
|
|
host: env.POSTGRES_HOST,
|
|
|
|
|
database: env.POSTGRES_DATABASE,
|
|
|
|
|
password: env.POSTGRES_PASSWORD,
|
|
|
|
|
port: Number(env.POSTGRES_PORT) || 5432,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const postgresClient = new PgClient({
|
|
|
|
|
pool: pgPool
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-07 13:20:31 +02:00
|
|
|
const OBJ_BASE_URL = "https://api-getway.objenious.com/ws"
|
|
|
|
|
export const httpObjClient = new HttpClient({
|
|
|
|
|
baseURL: OBJ_BASE_URL,
|
|
|
|
|
headers: {
|
|
|
|
|
"content-type": " application/json; charset=utf-8"
|
|
|
|
|
},
|
|
|
|
|
jwtManager: jwtService
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 17:31:20 +01:00
|
|
|
console.warn(`[T] TEST DB : ${env.POSTGRES_DATABASE}@${env.POSTGRES_HOST}`)
|