-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-env.js
More file actions
executable file
·26 lines (22 loc) · 812 Bytes
/
setup-env.js
File metadata and controls
executable file
·26 lines (22 loc) · 812 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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
// Generate a secure random string for JWT_SECRET
const generateSecret = () => crypto.randomBytes(32).toString('hex');
const envPath = path.join(__dirname, '.env.local');
const envContent = `# Generated environment variables
JWT_SECRET=${generateSecret()}
`;
try {
fs.writeFileSync(envPath, envContent);
console.log('✅ Created .env.local file with secure JWT_SECRET');
console.log('You can now start the application with:');
console.log('npm run dev');
} catch (error) {
console.error('❌ Failed to create .env.local file:', error.message);
console.log(
'Please manually create a .env.local file with the following content:'
);
console.log(envContent);
}