-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathterragon-setup.sh
More file actions
executable file
·33 lines (22 loc) · 779 Bytes
/
terragon-setup.sh
File metadata and controls
executable file
·33 lines (22 loc) · 779 Bytes
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
#!/bin/bash
export XATA_BRANCHNAME=main
export XATA_DATABASENAME=app
# Install dependencies
bun install
# Install Xata CLI
curl -fsSL https://xata.io/install.sh | bash
# Setup PATH for Xata
export PATH="$HOME/.config/xata/bin:$PATH"
# Display Xata version and status
xata version
xata status
# Delete existing branch if it exists
xata branch delete $E2B_SANDBOX_ID --yes || true
# Create new branch (also does branch checkout)
xata branch create --name $E2B_SANDBOX_ID
unset XATA_BRANCHID
# Wait for branch to be ready
xata branch wait-ready $E2B_SANDBOX_ID
# Create .env file with database connection string
echo DATABASE_URL="$(xata branch view $E2B_SANDBOX_ID --json | jq -r '.connectionString')" > .env
echo "Setup complete! Database URL has been written to .env"