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

Commit

Permalink
Use extra/self-signed https certificates
Browse files Browse the repository at this point in the history
Closes #243
  • Loading branch information
ianldgs committed Jun 8, 2022
1 parent d4859a9 commit 286ac18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
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];
}

0 comments on commit 286ac18

Please sign in to comment.