[Feature Request]: If npm `cafile` setting exists, use it when downloading from unique ELECTRON_MIRROR
- Dominant language
- TypeScript
- Stars
- 366
- Forks
- 109
- Avg merge
- 4h 44m
- Merged PRs (30d)
- 3
Description
### Preflight Checklist
- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
### Problem Description
Currently, when using a custom `ELECTRON_MIRROR` value, if the mirror repository requires a CA file, then Electron will not use a local CA by default. The user must set the `NODE_EXTRA_CA_CERTS` variable to get it added, since the Electron post install script for installing the binary uses `node` in the command, and is not an `npm` install.
Note that running `npm` on a CI system, the cafile location may not be known ahead of time (could be set on the CI runner system). The current workaround is to dynamically call `npm config get cafile` and assign the value into `NODE_EXTRA_CA_CERTS`
### Proposed Solution
I think it would be helpful to automatically use the `cafile` value from `.npmrc` (npm config) when downloading a unique binary. Similar behavior was done in the `cypress` library (Cypress also downloads a binary with a zip using a post install and has a mirror environment variable).
See relevant code: https://github.com/search?q=repo%3Acypress-io%2Fcypress+getCa+%3D&type=code
Cypress docs for reference:
- [Mirroring](https://docs.cypress.io/guides/references/advanced-installation#Mirroring)
- [using custom CA](https://docs.cypress.io/guides/references/advanced-installation#Using-a-custom-certificate-authority-CA)
### Alternatives Considered
The current workaround is to dynamically call `npm config get cafile` and assign the value into `NODE_EXTRA_CA_CERTS`, which does work.. but can be tedious in a CI system since it may be dynamic
### Additional Information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.