Fix updating the server URL in the dashboard not updatinng.

This commit is contained in:
AdamT20054
2025-09-21 07:00:43 +01:00
parent fd76a9efd2
commit 8722bd170f
2 changed files with 6 additions and 5 deletions

View File

@@ -39,8 +39,9 @@ async function triggerCrontabUpdates() {
// The agent will detect this and run update-crontab command
const http = require('http');
const https = require('https');
const serverUrl = process.env.SERVER_URL || 'http://localhost:3001';
const settings = await prisma.settings.findFirst();
const serverUrl = settings?.server_url || process.env.SERVER_URL || 'http://localhost:3001';
const url = new URL(`${serverUrl}/api/v1/hosts/ping`);
const isHttps = url.protocol === 'https:';
const client = isHttps ? https : http;