Skip to content

Commit baf97ee

Browse files
FrostyApeOneFrostyApeOne
authored andcommitted
Added changelog and versioning
Added diagnostics page
1 parent 8039f8b commit baf97ee

5 files changed

Lines changed: 77 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this service will be documented in this file.
4+
5+
## [1.0.0] – Public Beta
6+
### Notes
7+
- First formally versioned public beta release.
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<UserSecretsId>8051c984-585b-4a5e-b6d7-833e5dd4afe7</UserSecretsId>
8-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<UserSecretsId>8051c984-585b-4a5e-b6d7-833e5dd4afe7</UserSecretsId>
8+
<Version>1.0.0</Version>
9+
<InformationalVersion>1.0.0</InformationalVersion>
10+
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
11+
</PropertyGroup>
912

10-
<ItemGroup>
11-
<PackageReference Include="GovUK.Dfe.CoreLibs.Security" Version="1.1.21-prerelease-15" />
12-
<PackageReference Include="GovUk.Frontend.AspNetCore" Version="3.2.2" />
13-
<PackageReference Include="HtmlSanitizer" Version="9.0.886" />
14-
<PackageReference Include="Markdig" Version="0.42.0" />
15-
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
16-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
17-
</ItemGroup>
13+
<ItemGroup>
14+
<PackageReference Include="GovUK.Dfe.CoreLibs.Security" Version="1.1.21-prerelease-15" />
15+
<PackageReference Include="GovUk.Frontend.AspNetCore" Version="3.2.2" />
16+
<PackageReference Include="HtmlSanitizer" Version="9.0.886" />
17+
<PackageReference Include="Markdig" Version="0.42.0" />
18+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
19+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
20+
</ItemGroup>
1821

19-
<ItemGroup>
20-
<ProjectReference Include="..\DfE.ExternalApplications.Application\DfE.ExternalApplications.Application.csproj" />
21-
<ProjectReference Include="..\DfE.ExternalApplications.Infrastructure\DfE.ExternalApplications.Infrastructure.csproj" />
22-
</ItemGroup>
22+
<ItemGroup>
23+
<ProjectReference Include="..\DfE.ExternalApplications.Application\DfE.ExternalApplications.Application.csproj" />
24+
<ProjectReference Include="..\DfE.ExternalApplications.Infrastructure\DfE.ExternalApplications.Infrastructure.csproj" />
25+
</ItemGroup>
2326

2427

2528
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@page
2+
@model DfE.ExternalApplications.Web.Pages.DiagnosticsModel
3+
@{
4+
Layout = null;
5+
}
6+
7+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Reflection;
2+
using Microsoft.AspNetCore.Authorization;
3+
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.AspNetCore.Mvc.RazorPages;
5+
6+
namespace DfE.ExternalApplications.Web.Pages;
7+
8+
/// <summary>
9+
/// Diagnostics endpoint that returns basic runtime information as JSON.
10+
/// </summary>
11+
[AllowAnonymous]
12+
public class DiagnosticsModel(IHostEnvironment hostEnvironment) : PageModel
13+
{
14+
/// <summary>
15+
/// Returns service name, environment name, and the assembly informational version.
16+
/// </summary>
17+
public IActionResult OnGet()
18+
{
19+
var assembly = typeof(Program).Assembly;
20+
var serviceName = assembly.GetName().Name ?? "Unknown";
21+
var environmentName = hostEnvironment.EnvironmentName;
22+
23+
var informationalVersion = assembly
24+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
25+
?.InformationalVersion;
26+
27+
var version = string.IsNullOrWhiteSpace(informationalVersion)
28+
? (assembly.GetName().Version?.ToString() ?? "Unknown")
29+
: informationalVersion;
30+
31+
return new JsonResult(new
32+
{
33+
service = serviceName,
34+
environment = environmentName,
35+
version
36+
});
37+
}
38+
}
39+
40+

src/DfE.ExternalApplications.Web/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383

8484
options.Conventions.AuthorizeFolder("/", "OpenIdConnectPolicy");
8585
options.Conventions.AllowAnonymousToPage("/Logout");
86+
87+
options.Conventions.AuthorizePage("/Diagnostics");
8688

8789
// Allow anonymous access to feedback pages
8890
options.Conventions.AllowAnonymousToPage("/Feedback/Index");

0 commit comments

Comments
 (0)