fix: sh scripts sometimes not finding .env file

!nuf
This commit is contained in:
Miodec 2024-08-08 17:01:24 +02:00
parent 316bbd33a6
commit d57e318cf1
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,11 @@
#!/bin/bash
source .env
# Determine the directory of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Source the .env file from the parent directory of the script's directory
source "$SCRIPT_DIR/../.env"
echo "Deploying backend to $BE_HOST with script $BE_SCRIPT_PATH"
# Connect to SSH and execute remote script

View file

@ -1,5 +1,11 @@
#!/bin/bash
source .env
# Determine the directory of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Source the .env file from the parent directory of the script's directory
source "$SCRIPT_DIR/../.env"
echo "Purging Cloudflare cache for zone $CF_ZONE_ID"
response=$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CF_API_KEY" \