feat(worker): TicketSystemConfig + ticket_api_base_url in worker.config.json
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using ClaudeDo.Worker.Config;
|
||||
|
||||
namespace ClaudeDo.Worker.Tickets;
|
||||
|
||||
/// <summary>
|
||||
/// Der eine Ort, der beantwortet "ist die Ticketsystem-Anbindung eingerichtet?".
|
||||
/// Liest die Base-URL aus dem WorkerConfig-Singleton (in-place aktualisiert vom Hub-Setter,
|
||||
/// also ohne Neustart wirksam) und den PAT aus dem DPAPI-Store. Beide fehlen im Normalfall,
|
||||
/// deshalb ist IsConfigured die billigste denkbare Abbruchbedingung: kein IO, keine DB.
|
||||
/// </summary>
|
||||
public sealed class TicketSystemConfig
|
||||
{
|
||||
private readonly WorkerConfig _worker;
|
||||
private readonly TicketPatStore _pat;
|
||||
|
||||
public TicketSystemConfig(WorkerConfig worker, TicketPatStore pat)
|
||||
{
|
||||
_worker = worker;
|
||||
_pat = pat;
|
||||
}
|
||||
|
||||
public string? BaseUrl => string.IsNullOrWhiteSpace(_worker.TicketApiBaseUrl)
|
||||
? null
|
||||
: _worker.TicketApiBaseUrl.Trim().TrimEnd('/');
|
||||
|
||||
public string? Token => _pat.Store.Read();
|
||||
|
||||
public bool IsConfigured => BaseUrl is not null && !string.IsNullOrEmpty(Token);
|
||||
}
|
||||
Reference in New Issue
Block a user