This commit is contained in:
Zeeshaun
2026-03-13 09:27:34 -05:00
parent 256f579489
commit a675c5f5b0
381 changed files with 20992 additions and 0 deletions
@@ -0,0 +1,33 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
namespace LCU.API.Internal.RepoApi.Repos.Models
{
public class EnvironmentView : IEnvironmentView
{
public string Application => _env.ApplicationName;
public DateTime CurrentDate => DateTime.Now;
public string BuildVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
public DateTime BuildDate => AssemblyBuildDate();
public string Environment => _env.EnvironmentName;
private readonly IHostingEnvironment _env;
public EnvironmentView(IHostingEnvironment env)
{
_env = env;
}
public static DateTime AssemblyBuildDate()
{
//https://stackoverflow.com/a/804310/266594
//TODO #246: Look up this value at start up to avoid hitting the filesystem repeatedly
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.FileInfo fileInfo = new System.IO.FileInfo(assembly.Location);
DateTime lastModified = fileInfo.LastWriteTime;
return lastModified;
}
}
}