Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Use extra/self-signed https certificates #286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/build-extension.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import FS from 'node:fs'
import Path from 'node:path'
import { fileURLToPath } from 'node:url'
import semver from 'semver'
import "./extra-certs.mjs";

/**
* @param {string} itemName
Expand Down
1 change: 1 addition & 0 deletions scripts/build-web-extension.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import esbuild from 'esbuild'
import Path from 'node:path'
import { fileURLToPath } from 'node:url'
import fetch from 'node-fetch'
import "./extra-certs.mjs";

const __dirname = Path.dirname(fileURLToPath(import.meta.url))

Expand Down
12 changes: 12 additions & 0 deletions scripts/extra-certs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-check
import https from "node:https";
import tls from "node:tls";
import fs from "node:fs";

if (typeof process.env.NODE_EXTRA_CA_CERTS === "string") {
const extraCerts = process.env.NODE_EXTRA_CA_CERTS.split(",").map((certPath) =>
fs.readFileSync(certPath, "utf8")
);

https.globalAgent.options.ca = [...tls.rootCertificates, ...extraCerts];
}