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:
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