20 lines
570 B
TypeScript
20 lines
570 B
TypeScript
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>'
|
|
});
|
|
|
|
// TODO: EJEMPLO, METER EN EL HTTP CLIENT
|
|
const result = await axios.get('https://myserver.internal.net:9443', { httpsAgent });
|
|
// do something with the result
|
|
|
|
// ...
|