diff --git a/Directory.Packages.props b/Directory.Packages.props
index b502b24..60882db 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -3,6 +3,7 @@
true
+
diff --git a/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs b/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs
index 1e9ec30..f28974d 100644
--- a/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs
+++ b/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs
@@ -1,4 +1,5 @@
-using Microsoft.OpenApi;
+using HealthMonitoring.Client;
+using Microsoft.OpenApi;
using Shared.Middleware;
using Shared.Monitoring;
@@ -25,7 +26,8 @@ public MiddlewareRegistry()
this.ConfigureControllers();
this.ConfigureMiddlewareLogging();
this.ConfigureJsonOptions();
- this.AddUptimeKuma();
+ this.AddHealthMonitoringRegistration(Startup.Configuration);
+
}
private void ConfigureJsonOptions()
diff --git a/EstateReportingAPI/EstateReportingAPI.csproj b/EstateReportingAPI/EstateReportingAPI.csproj
index c95708d..9ec1bdf 100644
--- a/EstateReportingAPI/EstateReportingAPI.csproj
+++ b/EstateReportingAPI/EstateReportingAPI.csproj
@@ -10,6 +10,8 @@
+
+
diff --git a/EstateReportingAPI/Program.cs b/EstateReportingAPI/Program.cs
index 4b16bce..3214cc4 100644
--- a/EstateReportingAPI/Program.cs
+++ b/EstateReportingAPI/Program.cs
@@ -69,7 +69,10 @@ private static IHostBuilder ConfigureWebHost(IHostBuilder hostBuilder, String ba
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddJsonFile($"/home/txnproc/config/appsettings.local.json", optional: true, reloadOnChange: true)
- .AddEnvironmentVariables();
+ .AddEnvironmentVariables().AddInMemoryCollection(new Dictionary
+ {
+ ["HealthMonitoring:Service:Version"] = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0"
+ });
// Keep existing static usage (if you must), and initialise the ConfigurationReader now.
Startup.Configuration = configBuilder.Build();
diff --git a/EstateReportingAPI/Startup.cs b/EstateReportingAPI/Startup.cs
index 7ca14e3..ee38b79 100644
--- a/EstateReportingAPI/Startup.cs
+++ b/EstateReportingAPI/Startup.cs
@@ -88,12 +88,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
});
});
- lifetime.ApplicationStarted.Register(() =>
- {
- host.RegisterWithUptimeKumaAsync()
- .GetAwaiter()
- .GetResult();
- });
}
}
}
\ No newline at end of file
diff --git a/EstateReportingAPI/appsettings.json b/EstateReportingAPI/appsettings.json
index cb3ccb4..6fcd5dc 100644
--- a/EstateReportingAPI/appsettings.json
+++ b/EstateReportingAPI/appsettings.json
@@ -14,6 +14,20 @@
"Url": "http://localhost:5011/health",
"IntervalInSeconds": 60
}
+ },
+ "HealthMonitoring": {
+ "Service": {
+ "ServiceId": "estate-reporting-api",
+ "Name": "Estate Reporting",
+ "Description": "Estate Reporting",
+ "HealthUrl": "http://localhost:5011/healthui"
+ },
+ "Dependencies": [
+ {
+ "DependencyName": "Read Model Server",
+ "TargetServiceId": "sql-server"
+ }
+ ]
}
}