Debug para tokens de Alai
This commit is contained in:
@@ -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
|
||||
|
||||
// ...
|
||||
|
||||
Reference in New Issue
Block a user