SNCB: remove hard-coded SSL CA certificate chain 🐛

This commit is contained in:
Jannis R 2024-08-13 13:35:36 +02:00
parent d2b490a4ff
commit 96f97f245e
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -11,13 +11,6 @@ import {parseLine} from '../../parse/line.js';
const baseProfile = require('./base.json');
import {products} from './products.js';
// `www.belgianrail.be:443` doesn't provide the necessary CA certificate
// chain for Node.js to trust the certificate, so we manually add it.
// todo: fix this properly, e.g. by letting them know
const ca = readFileSync(new URL('./digicert-sha2-secure-server-ca.crt.pem', import.meta.url).pathname);
const agent = new Agent({ca});
const transformReq = (ctx, req) => ({...req, agent});
// todo: this is ugly
const lineNameWithoutFahrtNr = ({parsed}) => {
const {name, fahrtNr} = parsed;
@ -58,8 +51,6 @@ const profile = {
locale: 'fr-BE',
timezone: 'Europe/Brussels',
transformReq,
products,
parseLine: parseHook(parseLine, lineNameWithoutFahrtNr),