Skip to content

Commit c9ce68b

Browse files
fmhallvercel[bot]
andauthored
Update packages/app/control/scripts/setup.sh
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
1 parent bc7ce83 commit c9ce68b

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
#!/bin/bash
22

3-
echo "Generating AUTH_SECRET..."
4-
AUTH_SECRET=$(node -e "console.log('AUTH_SECRET=' + require('crypto').randomBytes(32).toString('base64'))")
5-
echo $AUTH_SECRET
3+
# Check if .env file exists and if AUTH_SECRET is already set
4+
if [ -f .env ] && grep -q "^AUTH_SECRET=" .env; then
5+
echo "AUTH_SECRET already exists in .env file. Skipping generation."
6+
else
7+
echo "Generating AUTH_SECRET..."
8+
AUTH_SECRET=$(node -e "console.log('AUTH_SECRET=' + require('crypto').randomBytes(32).toString('base64'))")
9+
echo $AUTH_SECRET
10+
echo $AUTH_SECRET >> .env
11+
fi
612

7-
echo $AUTH_SECRET >> .env
8-
echo "DATABASE_URL='postgresql://echo_user:echo_password@localhost:5469/echo_control_v2?schema=public'" >> .env
13+
# Check if DATABASE_URL is already set
14+
if [ -f .env ] && grep -q "^DATABASE_URL=" .env; then
15+
echo "DATABASE_URL already exists in .env file. Skipping."
16+
else
17+
echo "DATABASE_URL='postgresql://echo_user:echo_password@localhost:5469/echo_control_v2?schema=public'" >> .env
18+
fi
919

1020
echo "Setup complete! You can now run 'pnpm dev' to start the development server."
11-
21+
No newline at end of file

0 commit comments

Comments
 (0)