-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
50 lines (44 loc) · 1.25 KB
/
Copy pathdev.sh
File metadata and controls
50 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Exit on any error
set -e
# Required environment variables
required_vars=(
"NEXT_PUBLIC_SUPABASE_URL"
"NEXT_PUBLIC_SUPABASE_KEY"
"SUPABASE_SERVICE_KEY"
"KV_URL"
"KV_REST_API_READ_ONLY_TOKEN"
"KV_REST_API_TOKEN"
"KV_REST_API_URL"
)
# Check if .env.local file exists and source it
if [ -f .env.local ]; then
source .env.local
else
echo "Error: .env.local file not found"
exit 1
fi
# Check if all required variables are set
missing_vars=()
for var in "${required_vars[@]}"; do
if [ -z "${!var}" ]; then
missing_vars+=("$var")
fi
done
# If any variables are missing, print them and exit
if [ ${#missing_vars[@]} -ne 0 ]; then
echo "Error: The following required environment variables are missing:"
printf '%s\n' "${missing_vars[@]}"
exit 1
fi
# Run the development command with all environment variables
echo "Starting development..."
env \
NEXT_PUBLIC_SUPABASE_URL="$NEXT_PUBLIC_SUPABASE_URL" \
NEXT_PUBLIC_SUPABASE_KEY="$NEXT_PUBLIC_SUPABASE_KEY" \
SUPABASE_SERVICE_KEY="$SUPABASE_SERVICE_KEY" \
KV_URL="$KV_URL" \
KV_REST_API_READ_ONLY_TOKEN="$KV_REST_API_READ_ONLY_TOKEN" \
KV_REST_API_TOKEN="$KV_REST_API_TOKEN" \
KV_REST_API_URL="$KV_REST_API_URL" \
sst dev