mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 01:14:23 +01:00
support custom cacerts in electron app
This commit is contained in:
parent
1ed39a5ea6
commit
18afb73238
@ -154,6 +154,21 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
else {
|
||||
const cacertArray = [preferences['cacert'], process.env.SSL_CERT_FILE, process.env.NODE_EXTRA_CA_CERTS];
|
||||
cacertFile = cacertArray.find(el => el);
|
||||
if (cacertFile && cacertFile.length > 1) {
|
||||
try {
|
||||
const fs = require('fs');
|
||||
caCrt = fs.readFileSync(cacertFile)
|
||||
request.httpsAgent = new https.Agent({
|
||||
ca: caCrt
|
||||
});
|
||||
} catch(err) {
|
||||
console.log('Error reading CA cert file:' + cacertFile, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const response = await axios(request);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user