SystemRegistry.GetVersion
parent
3267cc8a0d
commit
b4d0400845
|
@ -1,5 +1,5 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using System.Reflection;
|
using ProxmoxConnector.Server.Application.Utils;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -27,13 +27,10 @@ namespace ProxmoxConnector.Server.Application.Queries.System
|
||||||
|
|
||||||
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
|
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var version = GetVersion();
|
var version = SystemRegistry.GetVersion();
|
||||||
var result = new Model { Version = version };
|
var result = new Model { Version = version };
|
||||||
return await Task.FromResult(result);
|
return await Task.FromResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetVersion() =>
|
|
||||||
Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace ProxmoxConnector.Server.Application.Utils
|
||||||
|
{
|
||||||
|
public static class SystemRegistry
|
||||||
|
{
|
||||||
|
public static string GetVersion() =>
|
||||||
|
Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using ProxmoxConnector.Server.Application.Services.Environment;
|
using ProxmoxConnector.Server.Application.Services.Environment;
|
||||||
|
using ProxmoxConnector.Server.Application.Utils;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
@ -9,6 +10,7 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ProxmoxConnector.Server
|
namespace ProxmoxConnector.Server
|
||||||
{
|
{
|
||||||
|
@ -52,7 +54,7 @@ namespace ProxmoxConnector.Server
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var urls = configuration.GetValue<string>("urls");
|
var urls = configuration.GetValue<string>("urls");
|
||||||
Log.Information("Starting Proxmox connector...");
|
Log.Information($"Starting Proxmox connector {SystemRegistry.GetVersion()}...");
|
||||||
Log.Information($"API listening on {urls}");
|
Log.Information($"API listening on {urls}");
|
||||||
Log.Information($"Workspace configured at '{workspace}' path");
|
Log.Information($"Workspace configured at '{workspace}' path");
|
||||||
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
||||||
|
|
Loading…
Reference in New Issue