From 5df352de0674fd25bde3b149f82da74ac413e93d Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Fri, 18 Aug 2023 00:30:29 -0400 Subject: [PATCH] Enhanced logic for setting SSL_CERT_FILE and REQUESTS_CA_BUNDLE --- home/dot_config/shell/exports.sh.tmpl | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/home/dot_config/shell/exports.sh.tmpl b/home/dot_config/shell/exports.sh.tmpl index 3d6ba8a5..f3bb877c 100644 --- a/home/dot_config/shell/exports.sh.tmpl +++ b/home/dot_config/shell/exports.sh.tmpl @@ -152,12 +152,6 @@ fi # BW_CLIENTID client_id # BW_CLIENTSECRET -### CA Certificate -# Used by Python, cURL, and other tools -export CERT_PATH="$HOME/.local/etc/ssl/curl/cacert.pem" -export SSL_CERT_FILE="$CERT_PATH" -export REQUESTS_CA_BUNDLE="$CERT_PATH" - ### Cheat if command -v fzf > /dev/null; then export CHEAT_USE_FZF=true @@ -358,13 +352,17 @@ export PATH="$PATH:$PNPM_HOME" # Specify location of the default Prettierd configuration # export PRETTIERD_DEFAULT_CONFIG="" -### Python -# Replaced by certificate retrieved from the cURL website -# if command -v python3 > /dev/null; then -# export CERT_PATH="$(python3 -m certifi)" -# export SSL_CERT_FILE="$CERT_PATH" -# export REQUESTS_CA_BUNDLE="$CERT_PATH" -# fi +### Python / CA Certificate +# Used by Python, cURL, and other tools +if [ -f "$HOME/.local/etc/ssl/curl/cacert.pem" ]; then + export CERT_PATH="$HOME/.local/etc/ssl/curl/cacert.pem" + export SSL_CERT_FILE="$CERT_PATH" + export REQUESTS_CA_BUNDLE="$CERT_PATH" +elif command -v python3 > /dev/null; then + export CERT_PATH="$(python3 -m certifi)" || export CERT_PATH="$(python -m certifi)" + export SSL_CERT_FILE="$CERT_PATH" + export REQUESTS_CA_BUNDLE="$CERT_PATH" +fi ### Readline export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/readline/inputrc"