Add nbgv and add server info endpoint
Some checks failed
Build Vegasco Server / build (push) Failing after 59s
Some checks failed
Build Vegasco Server / build (push) Failing after 59s
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Vegasco.WebApi.Cars;
|
||||
using Vegasco.WebApi.Common;
|
||||
using Vegasco.WebApi.Consumptions;
|
||||
using Vegasco.WebApi.Info;
|
||||
|
||||
namespace Vegasco.WebApi.Endpoints;
|
||||
|
||||
@@ -46,5 +47,7 @@ public static class EndpointExtensions
|
||||
CreateConsumption.MapEndpoint(versionedApis);
|
||||
UpdateConsumption.MapEndpoint(versionedApis);
|
||||
DeleteConsumption.MapEndpoint(versionedApis);
|
||||
|
||||
GetServerInfo.MapEndpoint(versionedApis);
|
||||
}
|
||||
}
|
||||
|
||||
29
src/WebApi/Info/GetServerInfo.cs
Normal file
29
src/WebApi/Info/GetServerInfo.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
|
||||
namespace Vegasco.WebApi.Info;
|
||||
|
||||
public class GetServerInfo
|
||||
{
|
||||
public record Response(
|
||||
string FullVersion,
|
||||
string CommitId,
|
||||
DateTime CommitDate,
|
||||
string Environment);
|
||||
|
||||
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
||||
{
|
||||
return builder
|
||||
.MapGet("info/server", Endpoint)
|
||||
.WithTags("Info");
|
||||
}
|
||||
|
||||
private static Ok<Response> Endpoint(
|
||||
IHostEnvironment environment)
|
||||
{
|
||||
return TypedResults.Ok(new Response(
|
||||
ThisAssembly.AssemblyInformationalVersion,
|
||||
ThisAssembly.GitCommitId,
|
||||
ThisAssembly.GitCommitDate,
|
||||
environment.EnvironmentName));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user