Debug para tokens de Alai

This commit is contained in:
2026-05-04 13:39:54 +02:00
parent 331d920379
commit 113d9f3786
19 changed files with 272 additions and 45 deletions

View File

@@ -1,19 +1,14 @@
import fs from 'fs';
import https from 'https';
import axios from 'axios';
import { env } from './env/env.js';
import path from 'path';
const certificatesDir = env.ALAI_CERTIFICATES_DIR
const certificateName = env.ALAI_CERTIFICATE_NAME
// ...
const httpsAgent = new https.Agent({
pfx: fs.readFileSync(path.join(certificatesDir, 'keystore.p12')),
passphrase: '<your_keystore_passphrase_here>'
const certificatesDir = String(env.ALAI_CERTIFICATES_DIR)
const certificateName = String(env.ALAI_CERTIFICATE_NAME)
const certificatePassword = String(env.ALAI_CERTIFICATE_PASSWORD)
export const httpsAgent = new https.Agent({
pfx: fs.readFileSync(path.join(certificatesDir, certificateName)),
passphrase: certificatePassword
});
// TODO: EJEMPLO, METER EN EL HTTP CLIENT
const result = await axios.get('https://myserver.internal.net:9443', { httpsAgent });
// do something with the result
// ...