Support ERL_CACERTS_PATH env var when reading certificates #8874
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request allows setting an env var with the location of certificates.
Currently we are seeing a proliferation of env vars for reading certificates from in the Elixir community. Here are some examples:
This means anyone using Elixir/Erlang behind a proxy needs to setup several env vars, carefully reading the docs of each package that may do external HTTP requests.
For this reason, I was thinking about unifying them all in Elixir and provide a
ELIXIR_CACERTS_PATH
that is read at boot time. However, I believe a solution upstream in Erlang itself would be even better, as it would avoid the same issue (of several multiple env vars) happening within Erlang packages, escripts, etc.I understand it is possible to call
public_key:cacerts_load/1
but I don't believe it fully solves the problem:If we leave it up for each package to call
public_key:cacerts_load/1
, then we land in the same problem described here, but even worse, as one package would globally override the defaults of othersIf we leave it up for users of the packages to call it, then it means they need to add logic to each of their applications and packages that they use. And doing so for escripts is even harder.
I also think an env var is better than the application environment for running escripts and so on, where setting the application environment is not as straight-forward (it could be set via the ERL_AFLAGS/ERL_ZFLAGS but it is more verbose).
If this is accepted, please double check the environment variable name to see if it adheres to Erlang/OTP's standards.