mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Add footer to know what is the current running build
This commit is contained in:
parent
b71f9d0a08
commit
59ce3b5fc0
@ -113,6 +113,7 @@ namespace BTCPayServer.Hosting
|
||||
runtime.Configure(o.GetRequiredService<BTCPayServerOptions>());
|
||||
return runtime;
|
||||
});
|
||||
services.AddSingleton<BTCPayServerEnvironment>();
|
||||
services.TryAddSingleton<TokenRepository>();
|
||||
services.TryAddSingleton(o => o.GetRequiredService<BTCPayServerRuntime>().InvoiceRepository);
|
||||
services.TryAddSingleton<Network>(o => o.GetRequiredService<BTCPayServerOptions>().Network);
|
||||
|
47
BTCPayServer/Services/BTCPayServerEnvironment.cs
Normal file
47
BTCPayServer/Services/BTCPayServerEnvironment.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
public class BTCPayServerEnvironment
|
||||
{
|
||||
public BTCPayServerEnvironment(IHostingEnvironment env)
|
||||
{
|
||||
Version = typeof(BTCPayServerEnvironment).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
|
||||
#if DEBUG
|
||||
Build = "Debug";
|
||||
#else
|
||||
Build = "Release";
|
||||
#endif
|
||||
Environment = env;
|
||||
}
|
||||
public IHostingEnvironment Environment
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string Version
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string Build
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder txt = new StringBuilder();
|
||||
txt.Append($"@Copyright BTCPayServer v{Version}");
|
||||
if(!Environment.IsProduction() || Build.Equals("Release", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
txt.Append($" Environment: {Environment.EnvironmentName} Build: {Build}");
|
||||
}
|
||||
return txt.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject RoleManager<IdentityRole> RoleManager
|
||||
@inject BTCPayServer.Services.BTCPayServerEnvironment env
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@ -75,7 +76,9 @@
|
||||
</div>
|
||||
</nav>
|
||||
@RenderBody()
|
||||
|
||||
<footer class="bg-dark">
|
||||
<div class="container" style="text-align:right;font-size:10px; ">@env.ToString()</div>
|
||||
</footer>
|
||||
<!-- Bootstrap core JavaScript -->
|
||||
<script src="~/vendor/jquery/jquery.min.js"></script>
|
||||
<script src="~/vendor/popper/popper.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user