fix: pull down crt, key and pem in one operation

This commit is contained in:
Ruben Solvang 2025-05-07 14:29:55 +02:00
parent 5edef1fe64
commit 5c706ba5d4

View file

@ -89,7 +89,6 @@ download_and_verify_cert() {
local temp_key="$TEMP_DIR/$domain.key" local temp_key="$TEMP_DIR/$domain.key"
local temp_pem="$TEMP_DIR/$domain.pem" local temp_pem="$TEMP_DIR/$domain.pem"
echo -e "${BLUE}Processing certificate for $domain${NC}" echo -e "${BLUE}Processing certificate for $domain${NC}"
# Download certificate # Download certificate
@ -178,13 +177,13 @@ install_certificate() {
return 1 return 1
fi fi
local files=("$final_pem") local files=("$final_pem")
else fi
if ! cp -f "$temp_cert" "$final_cert" || ! cp -f "$temp_key" "$final_key"; then if ! cp -f "$temp_cert" "$final_cert" || ! cp -f "$temp_key" "$final_key"; then
echo -e "${RED}Failed to install certificate files for $domain${NC}" echo -e "${RED}Failed to install certificate files for $domain${NC}"
return 1 return 1
fi fi
local files=("$final_cert" "$final_key") local files=("$final_cert" "$final_key")
fi
# Set permissions and ownership # Set permissions and ownership
for file in "${files[@]}"; do for file in "${files[@]}"; do