Skip to content

Commit 4c72521

Browse files
committed
refactor(scripts): use central .env for debug scripts
- db-debug.sh and log-debug.sh now use the central .env file - Remove separate .env.db-debug.sample file - Update documentation in script headers DEBUG_ADDRESS, DEBUG_SIGNATURE, and DEBUG_API_URL should now be added to the main .env file instead of a separate config.
1 parent 1aa3e2f commit 4c72521

3 files changed

Lines changed: 14 additions & 23 deletions

File tree

scripts/.env.db-debug.sample

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/db-debug.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
# ./scripts/db-debug.sh --asset-history Yapeal/EUR 10 # Show asset balance history
1111
#
1212
# Environment:
13-
# Copy .env.db-debug.sample to .env.db-debug and fill in your credentials
13+
# Uses the central .env file. Required variables:
14+
# - DEBUG_ADDRESS: Wallet address with DEBUG role
15+
# - DEBUG_SIGNATURE: Signature from signing the DFX login message
16+
# - DEBUG_API_URL (optional): API URL, defaults to https://api.dfx.swiss/v1
1417
#
1518
# Requirements:
1619
# - curl
@@ -102,18 +105,18 @@ esac
102105

103106
# --- Load environment ---
104107
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
105-
ENV_FILE="$SCRIPT_DIR/.env.db-debug"
108+
ENV_FILE="$SCRIPT_DIR/../.env"
106109

107110
if [ -f "$ENV_FILE" ]; then
108111
source "$ENV_FILE"
109112
else
110113
echo "Error: Environment file not found: $ENV_FILE"
111-
echo "Copy .env.db-debug.sample to .env.db-debug and fill in your credentials"
114+
echo "Create .env in the api root directory"
112115
exit 1
113116
fi
114117

115118
if [ -z "$DEBUG_ADDRESS" ] || [ -z "$DEBUG_SIGNATURE" ]; then
116-
echo "Error: DEBUG_ADDRESS and DEBUG_SIGNATURE must be set in $ENV_FILE"
119+
echo "Error: DEBUG_ADDRESS and DEBUG_SIGNATURE must be set in .env"
117120
exit 1
118121
fi
119122

scripts/log-debug.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,28 @@
1515
# -h, --hours <n> Time range in hours (default: 1, max: 168)
1616
#
1717
# Environment:
18-
# Copy .env.db-debug.sample to .env.db-debug and fill in your credentials
18+
# Uses the central .env file. Required variables:
19+
# - DEBUG_ADDRESS: Wallet address with DEBUG role
20+
# - DEBUG_SIGNATURE: Signature from signing the DFX login message
21+
# - DEBUG_API_URL (optional): API URL, defaults to https://api.dfx.swiss/v1
1922

2023
set -e
2124

2225
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23-
ENV_FILE="$SCRIPT_DIR/.env.db-debug"
26+
ENV_FILE="$SCRIPT_DIR/../.env"
2427

2528
# Load environment variables
2629
if [ -f "$ENV_FILE" ]; then
2730
source "$ENV_FILE"
2831
else
2932
echo "Error: Environment file not found: $ENV_FILE"
30-
echo "Copy .env.db-debug.sample to .env.db-debug and fill in your credentials"
33+
echo "Create .env in the api root directory"
3134
exit 1
3235
fi
3336

3437
# Validate required variables
3538
if [ -z "$DEBUG_ADDRESS" ] || [ -z "$DEBUG_SIGNATURE" ]; then
36-
echo "Error: DEBUG_ADDRESS and DEBUG_SIGNATURE must be set in $ENV_FILE"
39+
echo "Error: DEBUG_ADDRESS and DEBUG_SIGNATURE must be set in .env"
3740
exit 1
3841
fi
3942

0 commit comments

Comments
 (0)