2017-10-27 05:08:18 +02:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Services
|
|
|
|
|
{
|
|
|
|
|
public class BTCPayServerEnvironment
|
|
|
|
|
{
|
2017-10-27 10:53:04 +02:00
|
|
|
|
public BTCPayServerEnvironment(IHostingEnvironment env)
|
|
|
|
|
{
|
|
|
|
|
Version = typeof(BTCPayServerEnvironment).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
|
2017-10-27 05:08:18 +02:00
|
|
|
|
#if DEBUG
|
2017-10-27 10:53:04 +02:00
|
|
|
|
Build = "Debug";
|
2017-10-27 05:08:18 +02:00
|
|
|
|
#else
|
|
|
|
|
Build = "Release";
|
|
|
|
|
#endif
|
2017-10-27 10:53:04 +02:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-27 05:08:18 +02:00
|
|
|
|
}
|