SlugEnt.APIInfo
1.2.0-beta-01
See the version list below for details.
dotnet add package SlugEnt.APIInfo --version 1.2.0-beta-01
NuGet\Install-Package SlugEnt.APIInfo -Version 1.2.0-beta-01
<PackageReference Include="SlugEnt.APIInfo" Version="1.2.0-beta-01" />
paket add SlugEnt.APIInfo --version 1.2.0-beta-01
#r "nuget: SlugEnt.APIInfo, 1.2.0-beta-01"
// Install SlugEnt.APIInfo as a Cake Addin #addin nuget:?package=SlugEnt.APIInfo&version=1.2.0-beta-01&prerelease // Install SlugEnt.APIInfo as a Cake Tool #tool nuget:?package=SlugEnt.APIInfo&version=1.2.0-beta-01&prerelease
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 | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.Routing (>= 2.2.2)
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Hosting (>= 6.0.1)
- Microsoft.Extensions.Logging (>= 6.0.0)
- SlugEnt.ResourceHealthChecker (>= 1.3.7)
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 | 103 | 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 |
Fixed bug