Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nimanikoo/Dotnet-RateLimiter/llms.txt

Use this file to discover all available pages before exploring further.

All runtime configuration for Dotnet-RateLimiter lives in appsettings.json. The file is intentionally minimal — there are only three top-level sections: Redis, Logging, and AllowedHosts. AddCustomRateLimiter reads the Redis:ConnectionString value at startup to establish the IConnectionMultiplexer singleton and register the health check probe. Everything else follows standard ASP.NET Core conventions.

Default appsettings.json

This is the complete file shipped with the project:
{
  "Redis": {
    "ConnectionString": "localhost:6379,abortConnect=false"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

Configuration Reference

Redis:ConnectionString
string
The StackExchange.Redis connection string used to connect to your Redis instance. Read by AddCustomRateLimiter via configuration.GetSection("Redis:ConnectionString").Value.Default: localhost:6379,abortConnect=falseThe abortConnect=false option is significant: it instructs StackExchange.Redis not to throw an exception at startup if Redis is unreachable. The application will start normally and Redis connectivity will be reattempted on first use. Remove this flag in production if you require a hard failure at boot when Redis is unavailable.
{
  "Redis": {
    "ConnectionString": "localhost:6379,abortConnect=false"
  }
}
Logging:LogLevel:Default
string
The minimum log level for all application code that does not match a more specific category filter.Default: InformationValid values (in ascending severity): Trace, Debug, Information, Warning, Error, Critical, None.
{
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    }
  }
}
Logging:LogLevel:Microsoft.AspNetCore
string
Overrides the log level specifically for all ASP.NET Core framework log categories (routing, middleware pipeline, request handling, etc.).Default: WarningSetting this to Warning suppresses the verbose Information-level framework logs that appear during normal request processing, keeping your log output focused on application-level events.
{
  "Logging": {
    "LogLevel": {
      "Microsoft.AspNetCore": "Warning"
    }
  }
}
AllowedHosts
string
A semicolon-separated list of host headers the application will accept. Used by ASP.NET Core’s host filtering middleware.Default: * (all hosts allowed)In production, restrict this to your actual hostname(s), for example "api.example.com;www.example.com".
{
  "AllowedHosts": "*"
}

Docker Compose Environment Variable Override

When running inside Docker Compose, the Redis service is reachable via the container name redis rather than localhost. Override the connection string using an environment variable in your compose.yaml:
services:
  app:
    environment:
      - Redis__ConnectionString=redis:6379,abortConnect=false
ASP.NET Core maps environment variables to configuration keys by replacing __ (double underscore) with :. So Redis__ConnectionString maps to the Redis:ConnectionString configuration key, overriding the value in appsettings.json at runtime without modifying the file.

Development vs Production

Development

The default appsettings.json targets a local Redis instance, which is suitable for development and Docker Compose setups:
{
  "Redis": {
    "ConnectionString": "localhost:6379,abortConnect=false"
  }
}

Production

For production deployments, use a managed Redis service and always enable TLS. Examples: Azure Cache for Redis:
my-cache.redis.cache.windows.net:6380,ssl=true,password=<ACCESS_KEY>,abortConnect=false
Redis Cloud / ElastiCache (TLS):
my-redis.example.com:6380,ssl=true,password=<PASSWORD>,abortConnect=false
Supply credentials via environment variables rather than in the file itself:
# Set at deployment time (e.g., in your CI/CD pipeline or container platform)
Redis__ConnectionString="my-cache.redis.cache.windows.net:6380,ssl=true,password=<ACCESS_KEY>,abortConnect=false"
Never commit production Redis credentials to source control. The appsettings.json file is typically tracked by Git. Store sensitive connection strings in environment variables, a secrets manager (such as Azure Key Vault or AWS Secrets Manager), or ASP.NET Core’s User Secrets for local development. The project already has a UserSecretsId configured in Dotnet-RateLimiter.csproj, so dotnet user-secrets set works out of the box.

Build docs developers (and LLMs) love