james URL configuration refactoring

This commit is contained in:
EugeneTes
2026-01-20 11:41:01 +01:00
parent 7cd2c75d14
commit f3dc04f8ae
5 changed files with 12 additions and 7 deletions

View File

@@ -61,12 +61,14 @@ public class HeartbeatBackgroundTask
{
try
{
var url = _configuration.HeartbeatApiUrl;
var apiKey = _configuration.PrinterServerKey;
var url = _configuration.ApiUrl != null
? $"{_configuration.ApiUrl.TrimEnd('/')}/api/printerServer/heartbeat"
: null;
var apiKey = _configuration.ApiKey;
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(apiKey))
{
_logger.LogWarning("Heartbeat not configured (missing HeartbeatApiUrl or PrinterServerKey)");
_logger.LogWarning("Heartbeat not configured (missing ApiUrl or ApiKey)");
return;
}