fix: make CMS publish environment explicit
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
This commit is contained in:
+5
-4
@@ -450,11 +450,12 @@ if (toast) setTimeout(() => toast.remove(), 3500);
|
|||||||
|
|
||||||
const CMS_USER = process.env.CMS_USER;
|
const CMS_USER = process.env.CMS_USER;
|
||||||
const CMS_PASS = process.env.CMS_PASS;
|
const CMS_PASS = process.env.CMS_PASS;
|
||||||
|
const CMS_DEPLOY_ENV = process.env.CMS_DEPLOY_ENV;
|
||||||
const CSRF_TOKEN = process.env.CMS_CSRF_TOKEN || crypto.randomBytes(32).toString('hex');
|
const CSRF_TOKEN = process.env.CMS_CSRF_TOKEN || crypto.randomBytes(32).toString('hex');
|
||||||
const rateLimits = new Map();
|
const rateLimits = new Map();
|
||||||
|
|
||||||
function securityConfigIsValid() {
|
function securityConfigIsValid() {
|
||||||
return Boolean(CMS_USER && CMS_PASS);
|
return Boolean(CMS_USER && CMS_PASS && ['staging', 'production'].includes(CMS_DEPLOY_ENV));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getClientAddress(req) {
|
function getClientAddress(req) {
|
||||||
@@ -595,8 +596,8 @@ const server = http.createServer(async (req, res) => {
|
|||||||
res.end(JSON.stringify({ ok: false, error: stderr || stdout || error.message }));
|
res.end(JSON.stringify({ ok: false, error: stderr || stdout || error.message }));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If a deploy.sh script exists, run it optionally in background
|
// Deploy only the explicitly configured environment; never default to production.
|
||||||
exec('cd ../../../ && ./deploy.sh production > deploy.log 2>&1 &');
|
exec(`cd ../../../ && ./deploy.sh ${CMS_DEPLOY_ENV} > deploy.log 2>&1 &`);
|
||||||
writeAudit('publish_finished', { clientAddress, user: CMS_USER, result: 'ok' });
|
writeAudit('publish_finished', { clientAddress, user: CMS_USER, result: 'ok' });
|
||||||
res.end(JSON.stringify({ ok: true, output: stdout }));
|
res.end(JSON.stringify({ ok: true, output: stdout }));
|
||||||
}
|
}
|
||||||
@@ -619,7 +620,7 @@ const server = http.createServer(async (req, res) => {
|
|||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
if (!securityConfigIsValid()) {
|
if (!securityConfigIsValid()) {
|
||||||
throw new Error('CMS_USER és CMS_PASS nélkül a Content Editor nem indítható el.');
|
throw new Error('CMS_USER, CMS_PASS és érvényes CMS_DEPLOY_ENV nélkül a Content Editor nem indítható el.');
|
||||||
}
|
}
|
||||||
server.listen(PORT, '127.0.0.1', () => {
|
server.listen(PORT, '127.0.0.1', () => {
|
||||||
console.log(`\n✅ mozdIT Content Editor fut: http://localhost:${PORT}\n`);
|
console.log(`\n✅ mozdIT Content Editor fut: http://localhost:${PORT}\n`);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ const assert = require('assert/strict');
|
|||||||
|
|
||||||
process.env.CMS_USER = 'test-editor';
|
process.env.CMS_USER = 'test-editor';
|
||||||
process.env.CMS_PASS = 'not-a-real-secret';
|
process.env.CMS_PASS = 'not-a-real-secret';
|
||||||
|
process.env.CMS_DEPLOY_ENV = 'staging';
|
||||||
const {
|
const {
|
||||||
hasValidCredentials,
|
hasValidCredentials,
|
||||||
hasValidCsrfToken,
|
hasValidCsrfToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user