-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-firebase-env.sh
More file actions
executable file
·72 lines (58 loc) · 2.03 KB
/
setup-firebase-env.sh
File metadata and controls
executable file
·72 lines (58 loc) · 2.03 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Firebase Environment Variables Setup Script
# This script helps you create the .env.local file for Firebase configuration
echo "🔥 Firebase Comments Setup Script"
echo "=================================="
echo ""
# Check if .env.local already exists
if [ -f "client/.env.local" ]; then
echo "⚠️ .env.local already exists. Do you want to overwrite it? (y/n)"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo "📝 Overwriting existing .env.local file..."
else
echo "❌ Setup cancelled. Your existing .env.local file was preserved."
exit 0
fi
fi
echo ""
echo "📋 Please provide your Firebase project configuration:"
echo ""
# Get Firebase configuration values
echo "Enter your Firebase API Key:"
read -r api_key
echo "Enter your Firebase Auth Domain:"
read -r auth_domain
echo "Enter your Firebase Project ID:"
read -r project_id
echo "Enter your Firebase Storage Bucket:"
read -r storage_bucket
echo "Enter your Firebase Messaging Sender ID:"
read -r messaging_sender_id
echo "Enter your Firebase App ID:"
read -r app_id
echo ""
echo "📝 Creating .env.local file..."
# Create .env.local file
cat > client/.env.local << EOF
# Firebase Configuration
# Generated by setup-firebase-env.sh
# IMPORTANT: Use VITE_ prefix for all variables (Vite requirement)
VITE_FIREBASE_API_KEY=${api_key}
VITE_FIREBASE_AUTH_DOMAIN=${auth_domain}
VITE_FIREBASE_PROJECT_ID=${project_id}
VITE_FIREBASE_STORAGE_BUCKET=${storage_bucket}
VITE_FIREBASE_MESSAGING_SENDER_ID=${messaging_sender_id}
VITE_FIREBASE_APP_ID=${app_id}
EOF
echo ""
echo "✅ .env.local file created successfully!"
echo ""
echo "🔧 Next steps:"
echo "1. Restart your development server (npm run dev)"
echo "2. Navigate to any blog post to see the comment section"
echo "3. Test adding a comment"
echo ""
echo "📚 For detailed setup instructions, see FIREBASE_COMMENTS_SETUP_GUIDE.md"
echo ""
echo "🚀 Your Firebase comments are now ready to use!"