SlugEnt.APIInfo
1.8.0
dotnet add package SlugEnt.APIInfo --version 1.8.0
NuGet\Install-Package SlugEnt.APIInfo -Version 1.8.0
<PackageReference Include="SlugEnt.APIInfo" Version="1.8.0" />
paket add SlugEnt.APIInfo --version 1.8.0
#r "nuget: SlugEnt.APIInfo, 1.8.0"
// Install SlugEnt.APIInfo as a Cake Addin #addin nuget:?package=SlugEnt.APIInfo&version=1.8.0 // Install SlugEnt.APIInfo as a Cake Tool #tool nuget:?package=SlugEnt.APIInfo&version=1.8.0
APIInfo
Provides some of the functionality that the Steeltoe Management Health library did. I was having issues with that library consistently running as well as difficulty with some of the documentation. I also wanted some other features.
Simplified Use
You just need to make a couple of additions to your hostbuilder to add an object and then a couple of entries to startup.cs to add them to the pipeline.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) => {
// Set APIInfo Object and override the default root path to infotest...
// You typically would not override the default, this just shows you can.
APIInfoBase apiInfoBase = new ("infotest");
services.AddSingleton<IAPIInfoBase>(apiInfoBase);
// Add a SimpleInfo retriever - Host Information
services.AddTransient<ISimpleInfoRetriever, SimpleRetrieverHostInfo>();
The APIInfoBase object is required as is the services.AddSingleton<IAPIInfoBase>(apiInfoBase) line. The AddConfigHideCriteria is an optional piece discussed later.
The startup.cs file needs the following additions:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapSlugEntPing();
endpoints.MapSlugEntSimpleInfo();
endpoints.MapSlugEntConfig();
});
The endpoints.MapSlug... lines just activate various endpoint info.
MapSlugEntPing
Provides a very simple response in the form of ping...pong. Just tells you the service is responding and working. Can use it for automations that just need to know is the service is responding or not.
Default Endpoint:
/info/ping
MapSlugEntSimpleInfo
Provides some basic information about the service that you can customize. The simple info page can be divided into sections with each section getting customized information from a class you write.
Default Endpoint:
/info/simple
MapSlugEntConfig
Provides configuration (IConfiguration) related information about the API service that it has while running. You have to be careful with this module as it will display your entire Configuration object. It therefore provides the ability to match on entire Key names or partial key names to hide values that you do not wish displayed. Values that are marked hidden are never sent to the web page, but instead are replaced with the word HIDDEN. They therefore cannot be leaked by viewing the page source.
Default Endpoint:
/info/config
apiInfoBase.AddConfigHideCriteria("password");
apiInfoBase.AddConfigHideCriteria("os");
apiInfoBase.AddConfigHideCriteria("urls",false,false);
apiInfoBase.AddConfigHideCriteria("LogLevel", true);
apiInfoBase.AddConfigHideCriteria("environment", false, false);
// Override and allow one URLS entry to display. Note, these are exact match and case sensitive
apiInfoBase.AddConfigOverrideString("ASPNETCORE_URLS");
MapSlugEntHealth
Provides a view to the Health Check of the Application. This can include periodic checks to File Sytems, Databases and RabbitMQ servers at the moment. But more can be added. It utilizes the SlugEnt.ResourceHealthChecker library to provide the actual health checks.
Default Endpoint:
/info/health
Sample App
There is a sample app that demonstrates the key components.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- SlugEnt.ResourceHealthChecker (>= 1.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.8.0 | 101 | 10/20/2024 |
1.3.0 | 154 | 5/17/2024 |
1.2.0-beta-01 | 306 | 9/28/2023 |
1.1.0 | 340 | 9/18/2023 |
1.0.4 | 762 | 7/25/2022 |
1.0.3 | 735 | 6/16/2022 |
0.4.0-alpha-0000 | 467 | 11/17/2021 |
0.3.0-alpha-0000 | 491 | 11/17/2021 |
0.2.0-alpha-0000 | 464 | 11/15/2021 |
0.1.0-alpha-0000 | 539 | 11/14/2021 |
.Net 8 Upgrade