feat(agent): expose assembly version via GET /api/version (#171)
This commit is contained in:
1 parent
4b3068e12f
commit
98f77073a1
1 file changed
+20
@@ -1,3 +1,4 @@
|
||||
using System.Reflection;
|
||||
using Sentry.AspNetCore;
|
||||
|
||||
using Heimdall.Agent;
|
||||
@@ -168,6 +169,25 @@ app.MapHealthChecks("/healthz", new HealthCheckOptions
|
||||
}
|
||||
});
|
||||
|
||||
// ── Version endpoint — exposes assembly version for auto-update (ticket #100) ──
|
||||
// Public (no auth): used by agents and external tooling for version checks.
|
||||
app.MapGet("/api/version", () =>
|
||||
{
|
||||
var assembly = typeof(AgentOptions).Assembly;
|
||||
var informational = assembly
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion;
|
||||
var version = assembly.GetName().Version?.ToString() ?? "0.0.0";
|
||||
|
||||
return Results.Ok(new
|
||||
{
|
||||
version = informational?.Split('+')[0] ?? version,
|
||||
informational,
|
||||
environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production",
|
||||
timestamp = DateTime.UtcNow,
|
||||
});
|
||||
});
|
||||
|
||||
// ── Prometheus metrics endpoint (spec 13.1) ────────────────────────
|
||||
app.MapPrometheusScrapingEndpoint("/metrics");
|
||||
|
||||
|
||||
Reference in new issue
Block a user