added ability to specify deploy key path

This commit is contained in:
Muhammad Ibrahim
2025-09-18 01:02:51 +01:00
parent c497c1db2a
commit 08f82bc795
5 changed files with 95 additions and 53 deletions

View File

@@ -123,7 +123,8 @@ router.put('/', authenticateToken, requireManageSettings, [
body('frontendUrl').isLength({ min: 1 }).withMessage('Frontend URL is required'),
body('updateInterval').isInt({ min: 5, max: 1440 }).withMessage('Update interval must be between 5 and 1440 minutes'),
body('autoUpdate').isBoolean().withMessage('Auto update must be a boolean'),
body('githubRepoUrl').optional().isLength({ min: 1 }).withMessage('GitHub repo URL must be a non-empty string')
body('githubRepoUrl').optional().isLength({ min: 1 }).withMessage('GitHub repo URL must be a non-empty string'),
body('sshKeyPath').optional().isLength({ min: 1 }).withMessage('SSH key path must be a non-empty string')
], async (req, res) => {
try {
console.log('Settings update request body:', req.body);
@@ -133,8 +134,8 @@ router.put('/', authenticateToken, requireManageSettings, [
return res.status(400).json({ errors: errors.array() });
}
const { serverProtocol, serverHost, serverPort, frontendUrl, updateInterval, autoUpdate, githubRepoUrl } = req.body;
console.log('Extracted values:', { serverProtocol, serverHost, serverPort, frontendUrl, updateInterval, autoUpdate, githubRepoUrl });
const { serverProtocol, serverHost, serverPort, frontendUrl, updateInterval, autoUpdate, githubRepoUrl, sshKeyPath } = req.body;
console.log('Extracted values:', { serverProtocol, serverHost, serverPort, frontendUrl, updateInterval, autoUpdate, githubRepoUrl, sshKeyPath });
// Construct server URL from components
const serverUrl = `${serverProtocol}://${serverHost}:${serverPort}`;
@@ -165,7 +166,8 @@ router.put('/', authenticateToken, requireManageSettings, [
frontendUrl,
updateInterval: updateInterval || 60,
autoUpdate: autoUpdate || false,
githubRepoUrl: githubRepoUrl || 'git@github.com:9technologygroup/patchmon.net.git'
githubRepoUrl: githubRepoUrl || 'git@github.com:9technologygroup/patchmon.net.git',
sshKeyPath: sshKeyPath || null
}
});
console.log('Settings updated successfully:', settings);
@@ -186,7 +188,8 @@ router.put('/', authenticateToken, requireManageSettings, [
frontendUrl,
updateInterval: updateInterval || 60,
autoUpdate: autoUpdate || false,
githubRepoUrl: githubRepoUrl || 'git@github.com:9technologygroup/patchmon.net.git'
githubRepoUrl: githubRepoUrl || 'git@github.com:9technologygroup/patchmon.net.git',
sshKeyPath: sshKeyPath || null
}
});
}