@fecommunity/reactpress-server 1.0.0-beta.15 → 1.0.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,31 @@ const { spawn } = require('child_process');
11
11
  const PORT = 3003;
12
12
  const SERVER_PORT = 3002;
13
13
 
14
+ // Load and set environment variables from .env file
15
+ function loadEnvVariables(envPath) {
16
+ try {
17
+ const envContent = fs.readFileSync(envPath, 'utf8');
18
+ const envLines = envContent.split('\n');
19
+
20
+ envLines.forEach(line => {
21
+ const trimmedLine = line.trim();
22
+ if (trimmedLine && !trimmedLine.startsWith('#')) {
23
+ const [key, ...valueParts] = trimmedLine.split('=');
24
+ if (key && valueParts.length > 0) {
25
+ const value = valueParts.join('=').trim();
26
+ process.env[key.trim()] = value;
27
+ }
28
+ }
29
+ });
30
+
31
+ console.log(chalk.cyan(`📝 Environment variables loaded from .env`));
32
+ return true;
33
+ } catch (error) {
34
+ console.log(chalk.yellow('⚠️ Could not load .env file:', error.message));
35
+ return false;
36
+ }
37
+ }
38
+
14
39
  // Main entry point with auto-detection
15
40
  async function main() {
16
41
  const args = process.argv.slice(2);
@@ -26,6 +51,8 @@ async function main() {
26
51
  await runInstallationWizard();
27
52
  } else {
28
53
  console.log(chalk.green('✅ Configuration found. Starting server...'));
54
+ // Load environment variables from .env file
55
+ loadEnvVariables(envPath);
29
56
  startServer();
30
57
  }
31
58
  }
@@ -147,6 +174,9 @@ SERVER_SITE_URL=${site.serverUrl}
147
174
  fs.writeFileSync(envPath, env);
148
175
  console.log(chalk.green('✅ Configuration saved to .env file'));
149
176
 
177
+ // Load the environment variables immediately
178
+ loadEnvVariables(envPath);
179
+
150
180
  res.json({
151
181
  success: true,
152
182
  message: 'ReactPress installed successfully! Starting server...',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecommunity/reactpress-server",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "ReactPress Server - NestJS-based backend API for ReactPress CMS",
5
5
  "author": "fecommunity",
6
6
  "license": "MIT",