-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-env.js
More file actions
49 lines (38 loc) Β· 1.94 KB
/
setup-env.js
File metadata and controls
49 lines (38 loc) Β· 1.94 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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
console.log('π§ CBMS Environment Setup\n');
const envPath = path.join(process.cwd(), '.env.local');
if (fs.existsSync(envPath)) {
console.log('β οΈ .env.local file already exists!');
console.log('Please check if it contains the correct Supabase credentials.\n');
const content = fs.readFileSync(envPath, 'utf8');
if (content.includes('your_supabase_project_url') || content.includes('your_supabase_anon_key')) {
console.log('β Your .env.local file contains placeholder values.');
console.log('Please replace them with your actual Supabase credentials.\n');
} else {
console.log('β
Your .env.local file appears to be configured.');
}
} else {
console.log('π Creating .env.local file...\n');
const envContent = `# Supabase Configuration
# Replace these placeholder values with your actual Supabase project credentials
# You can find these in your Supabase project dashboard under Settings > API
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url_here
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key_here
# Example format:
# NEXT_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
# NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
`;
fs.writeFileSync(envPath, envContent);
console.log('β
Created .env.local file with placeholder values.');
console.log('π Next steps:');
console.log(' 1. Go to https://supabase.com/dashboard');
console.log(' 2. Create a new project or select an existing one');
console.log(' 3. Navigate to Settings β API');
console.log(' 4. Copy your Project URL and anon key');
console.log(' 5. Replace the placeholder values in .env.local');
console.log(' 6. Restart your development server\n');
}
console.log('π For detailed instructions, see SETUP.md');
console.log('π Supabase Dashboard: https://supabase.com/dashboard');