mango-cms 0.2.8 → 0.2.9
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.
- package/cli.js +21 -17
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -422,26 +422,30 @@ async function configureWebServer(settings, buildPath) {
|
|
|
422
422
|
`/etc/apache2/sites-available/${settings.siteName.toLowerCase()}.conf`;
|
|
423
423
|
|
|
424
424
|
try {
|
|
425
|
-
//
|
|
426
|
-
fs.
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (webServer === 'nginx') {
|
|
430
|
-
// Create symlink if it doesn't exist
|
|
431
|
-
const enabledPath = `/etc/nginx/sites-enabled/${settings.siteName.toLowerCase()}`;
|
|
432
|
-
if (!fs.existsSync(enabledPath)) {
|
|
433
|
-
execSync(`sudo ln -s ${configPath} ${enabledPath}`);
|
|
434
|
-
}
|
|
435
|
-
// Test and reload nginx
|
|
436
|
-
execSync('sudo nginx -t');
|
|
437
|
-
execSync('sudo systemctl reload nginx');
|
|
425
|
+
// Check if config already exists
|
|
426
|
+
if (fs.existsSync(configPath)) {
|
|
427
|
+
console.log(`${webServer} configuration already exists at ${configPath}, skipping creation`);
|
|
438
428
|
} else {
|
|
439
|
-
//
|
|
440
|
-
|
|
441
|
-
|
|
429
|
+
// Write config file only if it doesn't exist
|
|
430
|
+
fs.writeFileSync(configPath, config);
|
|
431
|
+
console.log(`Created ${webServer} configuration at ${configPath}`);
|
|
432
|
+
|
|
433
|
+
if (webServer === 'nginx') {
|
|
434
|
+
// Create symlink if it doesn't exist
|
|
435
|
+
const enabledPath = `/etc/nginx/sites-enabled/${settings.siteName.toLowerCase()}`;
|
|
436
|
+
if (!fs.existsSync(enabledPath)) {
|
|
437
|
+
execSync(`sudo ln -s ${configPath} ${enabledPath}`);
|
|
438
|
+
}
|
|
439
|
+
execSync('sudo nginx -t');
|
|
440
|
+
execSync('sudo systemctl reload nginx');
|
|
441
|
+
} else {
|
|
442
|
+
// Enable apache site
|
|
443
|
+
execSync(`sudo a2ensite ${settings.siteName.toLowerCase()}`);
|
|
444
|
+
execSync('sudo systemctl reload apache2');
|
|
445
|
+
}
|
|
446
|
+
console.log(`${webServer} configuration has been updated and service reloaded`);
|
|
442
447
|
}
|
|
443
448
|
|
|
444
|
-
console.log(`${webServer} configuration has been updated and service reloaded`);
|
|
445
449
|
} catch (error) {
|
|
446
450
|
console.error(`Error configuring ${webServer}:`, error.message);
|
|
447
451
|
throw error;
|