-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-env.js
More file actions
executable file
·50 lines (38 loc) · 1.29 KB
/
setup-env.js
File metadata and controls
executable file
·50 lines (38 loc) · 1.29 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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const ENV_EXAMPLE = 'env.example';
const ENV_FILE = '.env';
function setupEnvironment() {
console.log('🔧 Setting up environment configuration...\n');
// Check if .env already exists
if (fs.existsSync(ENV_FILE)) {
console.log('✅ .env file already exists');
console.log(' If you want to reset it, delete .env and run this script again\n');
return;
}
// Check if env.example exists
if (!fs.existsSync(ENV_EXAMPLE)) {
console.error('❌ env.example file not found');
process.exit(1);
}
try {
// Copy env.example to .env
fs.copyFileSync(ENV_EXAMPLE, ENV_FILE);
console.log('✅ Created .env file from env.example');
console.log('✅ Environment file created');
console.log('\n🎉 Environment setup complete!');
console.log('\nNext steps:');
console.log('1. Edit .env file with your OAuth provider settings');
console.log('2. Run: pnpm run dev');
console.log('3. Or run: pnpm run build && pnpm start');
} catch (error) {
console.error('❌ Error setting up environment:', error.message);
process.exit(1);
}
}
// Run setup if this file is executed directly
if (require.main === module) {
setupEnvironment();
}
module.exports = { setupEnvironment };