Move version display to GET /api/health/version in HealthController
Uses GetApplicationVersion(Assembly.GetExecutingAssembly()) — the same timestamp-based version already logged at startup and baked into the assembly via the csproj <Version> property. Removes the minimal-API /version endpoint from web/Program.cs and reverts the web Dockerfile APP_VERSION build-arg (no longer needed). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
ENV ASPNETCORE_URLS=http://0.0.0.0:8080
|
||||
ARG APP_VERSION=1.0.0
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
ENTRYPOINT ["dotnet", "web.dll"]
|
||||
@@ -14,9 +14,6 @@ var app = builder.Build();
|
||||
|
||||
app.UseMiddleware<SiteModeMiddleware>();
|
||||
|
||||
app.MapGet("/version", (IConfiguration config) =>
|
||||
Results.Json(new { version = config["APP_VERSION"] ?? "unknown" }));
|
||||
|
||||
// Static site
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
|
||||
$('#year').text(new Date().getFullYear());
|
||||
|
||||
$.getJSON('/version').done(function (data) {
|
||||
$.getJSON('/api/health/version').done(function (data) {
|
||||
if (data && data.version) {
|
||||
$('#app-version').text('v' + data.version);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user