This repository was archived by the owner on Feb 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-env.js
More file actions
31 lines (27 loc) · 1.49 KB
/
setup-env.js
File metadata and controls
31 lines (27 loc) · 1.49 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
const fs = require('fs');
const path = require('path');
// Define the .env content with option for local MongoDB
const envContent = `PORT=3001
# MongoDB Atlas connection - requires IP whitelist configuration
# MONGODB_URI=mongodb+srv://spacesaibiz:YALAboys@cluster0.zcs04j3.mongodb.net/room-redesign?retryWrites=true&w=majority&appName=Cluster0
# Local MongoDB connection - requires local MongoDB installation
MONGODB_URI=mongodb://localhost:27017/room-redesign
JWT_SECRET=vKp+E9TA8U}JTc83z*dW2.W=R7{5f.Cqk}hM
NODE_ENV=development
LAOZANG_API_KEY=sk-JDMYnZIoNuIHnw560b1a618f3a1c4d2eA7778577012dAeF8`;
// Write the .env file
fs.writeFileSync(path.join(__dirname, '.env'), envContent);
console.log('Environment file (.env) created successfully!');
console.log('The following environment variables have been set:');
console.log('- PORT: 3001');
console.log('- MONGODB_URI: [Using local MongoDB instance]');
console.log('- JWT_SECRET: [Secret for JWT tokens]');
console.log('- NODE_ENV: development');
console.log('- LAOZANG_API_KEY: [API key for LaozHang]');
console.log('\nYou can now run the application with:');
console.log(' npm run dev');
console.log('\nNOTE: The MongoDB connection is set to use a local instance.');
console.log('If you want to use MongoDB Atlas, you need to:');
console.log('1. Visit https://cloud.mongodb.com/');
console.log('2. Add your IP address to the whitelist in Network Access settings');
console.log('3. Then update the MONGODB_URI in the .env file back to the Atlas connection string');