absolutealgorithm.api.common
Advanced tools
| { | ||
| "NLog": { | ||
| "autoReload": true, | ||
| "throwConfigExceptions": true, | ||
| "internalLogLevel": "Info", | ||
| "extensions": [ | ||
| { "assembly": "NLog.Web.AspNetCore" } | ||
| ], | ||
| "targets": { | ||
| "console": { | ||
| "type": "Console", | ||
| "layout": { | ||
| "type": "JsonLayout", | ||
| "includeMdlc": true, | ||
| "attributes": [ | ||
| { "name": "time", "layout": "${longdate}" }, | ||
| { "name": "level", "layout": "${uppercase:${level}}" }, | ||
| { "name": "message", "layout": "${message}" }, | ||
| { "name": "errorCode", "layout": "${event-properties:item=ErrorCode}" }, | ||
| { "name": "exception", "layout": "${exception:format=tostring}" }, | ||
| { "name": "area", "layout": "${event-properties:item=Area:whenEmpty=${logger}}" }, | ||
| { "name": "logId", "layout": "${aspnet-request:header=x-correlation-id}" }, | ||
| { "name": "ip", "layout": "${aspnet-request:header=x-ip-address}" }, | ||
| { "name": "userAgent", "layout": "${aspnet-request:header=x-user-agent}" } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "rules": [ | ||
| { "logger": "Microsoft.Hosting.Lifetime", "minLevel": "Fatal", "final": true, "writeTo": "console" }, | ||
| { "logger": "Microsoft.AspNetCore.Hosting.Diagnostics", "minLevel": "Fatal", "final": true, "writeTo": "console" }, | ||
| { "logger": "*", "minLevel": "Info", "maxLevel": "Error", "writeTo": "console" } | ||
| ] | ||
| } | ||
| } |
Sorry, the diff of this file is not supported yet
@@ -5,3 +5,3 @@ <?xml version="1.0" encoding="utf-8"?> | ||
| <id>AbsoluteAlgorithm.Api.Common</id> | ||
| <version>1.0.0-dev.13</version> | ||
| <version>1.0.0-dev.12</version> | ||
| <authors>S Lalith Prasad</authors> | ||
@@ -11,3 +11,3 @@ <readme>README.md</readme> | ||
| <tags>c# asp.net dotnet mssql postgresql ratelimit distributed-systems response-caching logging resiliency healthchecks swagger openapi-documentation</tags> | ||
| <repository type="git" commit="2a76d5b408058fa3bb7750a81da2b5cbe0e8a1a0" /> | ||
| <repository type="git" commit="d506e9abdfac1cff0d7ace3792811f9e48ba5831" /> | ||
| <dependencies> | ||
@@ -30,3 +30,6 @@ <group targetFramework="net10.0"> | ||
| </frameworkReferences> | ||
| <contentFiles> | ||
| <files include="any/any/nlog.settings.json" buildAction="Content" copyToOutput="true" /> | ||
| </contentFiles> | ||
| </metadata> | ||
| </package> |
+28
-20
@@ -13,4 +13,2 @@ # AbsoluteAlgorithm.Api.Common | ||
| Download from NuGet: [https://www.nuget.org/packages/AbsoluteAlgorithm.Api.Common](https://www.nuget.org/packages/AbsoluteAlgorithm.Api.Common) | ||
| ## Usage Setup | ||
@@ -66,2 +64,3 @@ | ||
| }; | ||
| #endregion | ||
@@ -92,23 +91,32 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args); | ||
| ### ApplicationConfiguration | ||
| - **`UseRelationalDatabase`** (`bool`): Enables relational database services and middleware. | ||
| - **`DatabasePolicies`** (`List<DatabasePolicy>`): A list of database configurations to initialize and manage. | ||
| - **`UseRateLimit`** (`bool`): Enables rate limiting middleware. | ||
| - **`RateLimitPolicies`** (`List<RateLimitPolicy>`): A list of rate limiting policies to apply. | ||
| | Property | Type | Description | | ||
| |----------|------|-------------| | ||
| | `UseRelationalDatabase` | `bool` | Enables relational database services and middleware. | | ||
| | `DatabasePolicies` | `List<DatabasePolicy>` | List of database configurations to initialize and manage. | | ||
| | `UseRateLimit` | `bool` | Enables rate limiting middleware. | | ||
| | `RateLimitPolicies` | `List<RateLimitPolicy>` | List of rate limiting policies to apply. | | ||
| ### DatabasePolicy | ||
| - **`DatabaseProvider`** (`DatabaseProvider`): Specifies the database type (e.g., `MSSQL`, `PostgreSQL`). | ||
| - **`ConnectionStringName`** (`string`): The **environment variable name** that holds the connection string. | ||
| - **`InitializeDatabase`** (`bool`): If `true`, the library will attempt to create the database if it does not already exist. | ||
| - **`InitializeAuditTable`** (`bool`): If `true`, sets up the `audit_logs` table and corresponding triggers for automatic logging. | ||
| - **`InitializationScript`** (`string`): A custom SQL script to be executed during the initialization phase, ideal for creating tables or seeding data. | ||
| - **`DatabaseName`** (`string`): A unique name for the database connection, used for managing connection pooling and other resources. | ||
| - **`MaxPoolSize`** (`int`): Defines the maximum number of connections allowed in the connection pool. | ||
| - **`MinPoolSize`** (`int`): Defines the minimum number of connections to maintain in the connection pool. | ||
| - **`CommandTimeoutSeconds`** (`int`): The time in seconds to wait for a database command to execute before it times out. | ||
| | Property | Type | Description | | ||
| |----------|------|-------------| | ||
| | `DatabaseProvider` | `DatabaseProvider` | The database type (e.g., `MSSQL`, `PostgreSQL`). | | ||
| | `ConnectionStringName` | `string` | **Environment variable name** containing the connection string. | | ||
| | `InitializeDatabase` | `bool` | If true, attempts to create the database if it doesn't exist. | | ||
| | `InitializeAuditTable` | `bool` | If true, sets up the `audit_logs` table and triggers. | | ||
| | `InitializationScript` | `string` | Custom SQL script executed during initialization (e.g., table creation). | | ||
| | `DatabaseName` | `string` | Unique name for the database connection (used for pooling/resources). | | ||
| | `MaxPoolSize` | `int` | Maximum size of the connection pool. | | ||
| | `MinPoolSize` | `int` | Minimum size of the connection pool. | | ||
| | `CommandTimeoutSeconds` | `int` | Time in seconds before a command times out. | | ||
| ### RateLimitPolicy | ||
| - **`PolicyName`** (`string`): A unique identifier for the rate limiting policy, which can be referenced in the `[EnableRateLimiting]` attribute on controllers or endpoints. | ||
| - **`Algorithm`** (`RateLimitAlgorithm`): The algorithm used for rate limiting (e.g., `FixedWindow`). | ||
| - **`Scope`** (`RateLimitScope`): The scope at which the limit is applied (e.g., `IpAddress`, `User`). | ||
| - **`PermitLimit`** (`int`): The number of requests permitted within the specified time window. | ||
| - **`Window`** (`TimeSpan`): The duration of the time window for the rate limit. | ||
| | Property | Type | Description | | ||
| |----------|------|-------------| | ||
| | `PolicyName` | `string` | Unique identifier for the policy (used in `[EnableRateLimiting]`). | | ||
| | `Algorithm` | `RateLimitAlgorithm` | The rate limiting algorithm (e.g., `FixedWindow`). | | ||
| | `Scope` | `RateLimitScope` | Scope of the limit (e.g., `IpAddress`, `User`). | | ||
| | `PermitLimit` | `int` | Number of permitted requests in the window. | | ||
| | `Window` | `TimeSpan` | Time window duration for the limit. | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet