-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-supabase.js
More file actions
120 lines (95 loc) · 3.6 KB
/
Copy pathsetup-supabase.js
File metadata and controls
120 lines (95 loc) · 3.6 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env node
/**
* Supabase Setup Script for Boreas MVP
* Helps configure real Supabase credentials
*/
const fs = require('fs');
const path = require('path');
console.log('🔧 Boreas MVP - Supabase Setup\n');
const envPath = path.join(__dirname, '.env');
const envBackupPath = path.join(__dirname, '.env.backup');
function createBackup() {
if (fs.existsSync(envPath)) {
fs.copyFileSync(envPath, envBackupPath);
console.log('✅ Backup created: .env.backup');
}
}
function updateEnvFile(config) {
const envContent = `# Supabase - Production Configuration
NEXT_PUBLIC_SUPABASE_URL=${config.url}
NEXT_PUBLIC_SUPABASE_ANON_KEY=${config.anonKey}
SUPABASE_SERVICE_ROLE_KEY=${config.serviceKey}
# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_ENVIRONMENT=development
# Analytics Configuration - Enabled for development testing
NEXT_PUBLIC_POSTHOG_KEY=ph_development_key
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
POSTHOG_PROJECT_API_KEY=phx_development_key
NEXT_PUBLIC_ENABLE_ANALYTICS=true
NEXT_PUBLIC_ENABLE_SESSION_RECORDING=true
NEXT_PUBLIC_ENABLE_PERFORMANCE_MONITORING=true
# External Services - TODO: Add when ready for production
RESEND_API_KEY=your_resend_api_key_here
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_key_here
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=your_recaptcha_site_key_here
# Rate Limiting - Using memory for development
# UPSTASH_REDIS_REST_URL=your_redis_url
# UPSTASH_REDIS_REST_TOKEN=your_redis_token
`;
fs.writeFileSync(envPath, envContent);
console.log('✅ .env file updated with new credentials');
}
function showInstructions() {
console.log(`
🌟 NEXT STEPS:
1. Go to Supabase Dashboard:
👉 https://app.supabase.com
2. Create New Project:
- Project name: boreas-mvp
- Database password: (create a strong password)
- Region: (choose closest to you)
3. Get API Keys:
- Go to Settings → API
- Copy Project URL and anon key
4. Update this script with your credentials:
- Edit line 27-29 in this file
- Run: node setup-supabase.js
5. Restart development server:
- npm run dev
📋 Current Issue:
Your .env file has placeholder Supabase credentials.
Authentication will NOT work until you replace them with real ones.
🔗 Quick Links:
- Supabase Dashboard: https://app.supabase.com
- Documentation: https://supabase.com/docs/guides/auth/auth-helpers/nextjs
`);
}
// Check if we have real credentials or placeholders
const currentEnv = fs.existsSync(envPath) ? fs.readFileSync(envPath, 'utf8') : '';
if (currentEnv.includes('xyzcompany.supabase.co') || currentEnv.includes('your-project')) {
console.log('❌ PLACEHOLDER CREDENTIALS DETECTED');
console.log('The .env file contains fake Supabase credentials.\n');
// Show instructions for getting real credentials
showInstructions();
} else if (process.argv[2] === 'update') {
// Manual update mode - user provides credentials
console.log('📝 Manual credential update mode');
console.log('Edit this file and add your Supabase credentials, then run again.');
// Example configuration - user needs to fill this
const config = {
url: 'https://YOUR_PROJECT.supabase.co',
anonKey: 'YOUR_ANON_KEY_HERE',
serviceKey: 'YOUR_SERVICE_ROLE_KEY_HERE'
};
if (config.url.includes('YOUR_PROJECT')) {
console.log('❌ Please edit this script with your real Supabase credentials first.');
} else {
createBackup();
updateEnvFile(config);
console.log('\n🎉 Credentials updated! Restart your dev server.');
}
} else {
console.log('✅ .env file exists but may need verification.');
console.log('Run with "node setup-supabase.js update" to manually update credentials.');
}