chore: commit workspace changes
This commit is contained in:
1 parent
8bd9c6caf7
commit
71d1dbd5c1
2 files changed
+16
No files matched your search
@@ -2,6 +2,8 @@ module.exports = {
|
|||||||
apps: [{
|
apps: [{
|
||||||
name: 'resource-monitor',
|
name: 'resource-monitor',
|
||||||
script: './server/index.js',
|
script: './server/index.js',
|
||||||
|
// Force single forked instance to avoid port conflicts
|
||||||
|
exec_mode: 'fork',
|
||||||
instances: 1,
|
instances: 1,
|
||||||
autorestart: true,
|
autorestart: true,
|
||||||
watch: false,
|
watch: false,
|
||||||
@@ -10,6 +12,11 @@ module.exports = {
|
|||||||
NODE_ENV: 'production',
|
NODE_ENV: 'production',
|
||||||
PORT: 3001,
|
PORT: 3001,
|
||||||
TIMEZONE: 'America/New_York'
|
TIMEZONE: 'America/New_York'
|
||||||
|
},
|
||||||
|
env_production: {
|
||||||
|
NODE_ENV: 'production',
|
||||||
|
PORT: 3001,
|
||||||
|
TIMEZONE: 'America/New_York'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -143,6 +143,7 @@ app.post('/api/resources', (req, res) => {
|
|||||||
return res.status(400).json({ error: 'Name and URL are required' });
|
return res.status(400).json({ error: 'Name and URL are required' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const stmt = db.prepare(`
|
const stmt = db.prepare(`
|
||||||
INSERT INTO resources (name, url, type, check_interval, timeout, group_id, http_keyword, http_headers, quiet_hours_start, quiet_hours_end, cert_expiry_days, sla_target, email_to, maintenance_mode)
|
INSERT INTO resources (name, url, type, check_interval, timeout, group_id, http_keyword, http_headers, quiet_hours_start, quiet_hours_end, cert_expiry_days, sla_target, email_to, maintenance_mode)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
@@ -170,6 +171,14 @@ app.post('/api/resources', (req, res) => {
|
|||||||
cache.invalidatePattern('sla:');
|
cache.invalidatePattern('sla:');
|
||||||
|
|
||||||
res.json({ id: result.lastInsertRowid, message: 'Resource created' });
|
res.json({ id: result.lastInsertRowid, message: 'Resource created' });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[API] Error creating resource:', err.message);
|
||||||
|
// Helpful hint if migration missing
|
||||||
|
const hint = err.message.includes('no column named maintenance_mode')
|
||||||
|
? 'Database schema missing maintenance_mode. Restart server to run migrations.'
|
||||||
|
: undefined;
|
||||||
|
res.status(500).json({ error: 'Failed to create resource', details: err.message, hint });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update resource
|
// Update resource
|
||||||
|
|||||||
Reference in new issue
Block a user