Skip to content

Configuration

The Tech Strategy Tool is configured via standard ASP.NET Core configuration — appsettings.json files and environment variables. This page documents the available settings and their defaults.

Connection String

The only configuration the application reads from settings is the PostgreSQL connection string:

ConnectionStrings:DefaultConnection

This is used by the TechStratDbContext registered in Program.cs with UseNpgsql().

appsettings.json (base)

The base configuration file is minimal — it contains only logging defaults and no connection string:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

appsettings.Development.json

The development configuration adds the connection string matching the Docker Compose PostgreSQL credentials:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Port=5432;Database=techstrat;Username=techstrat;Password=techstrat_dev"
  }
}

Override via environment variable

ASP.NET Core's configuration system supports __ (double underscore) as a section separator in environment variables:

ConnectionStrings__DefaultConnection="Host=mydb;Port=5432;Database=techstrat;Username=app;Password=secret"

There is no explicit environment variable handling in the codebase — no GetEnvironmentVariable() calls, no .env file loading, no custom config providers. All environment variable support comes from ASP.NET Core's built-in configuration system.

Hardcoded Defaults

All operational settings beyond the connection string are hardcoded as constructor defaults or constants. There are no configuration sections for these values.

Setting Value Location
Checkpoint threshold 100 applied events EventProcessor constructor default
Session expiry 7 days AuthEndpoints.cs (TimeSpan.FromDays(7))
Login rate limit 5 attempts LoginRateLimiter constructor default
Login lockout duration 15 minutes LoginRateLimiter constructor default
Session cache TTL 5 minutes SessionCache constant (TimeSpan.FromMinutes(5))
SSE heartbeat interval 15 seconds SseHeartbeatService

Environment-Specific Behavior

Development mode

When ASPNETCORE_ENVIRONMENT=Development:

  • Auto-migration: EF Core migrations are applied automatically on startup via db.Database.MigrateAsync()
  • User seeding: Three default users are created if the users table is empty:
    • admin / admin (role: admin)
    • editor / editor (role: editor)
    • viewer / viewer (role: viewer)
  • Developer certificate: HTTPS uses the .NET developer certificate (dotnet dev-certs)

Both auto-migration and user seeding are gated behind app.Environment.IsDevelopment() in Program.cs. They do not run in any other environment.

Development only

Auto-migration and user seeding only run in Development mode. Other environments must apply migrations explicitly and create users through the Admin API.

Other environments

When ASPNETCORE_ENVIRONMENT is anything other than Development:

  • No auto-migration — apply migrations manually or via a deployment pipeline
  • No user seeding — create the initial admin user via direct database access or a setup script
  • HTTPS requires a proper certificate (see below)

HTTPS Configuration

Development

In development, the .NET developer certificate is used automatically. Ensure it is trusted:

dotnet dev-certs https --trust

The application URL is configured in launchSettings.json:

https://localhost:5001;http://localhost:5000

HTTPS is required for authentication

The session cookie is configured with Secure = true and SameSite = Strict. This means the browser will not send the cookie over plain HTTP. Authentication only works over HTTPS.

Production

There is no production HTTPS configuration in the codebase — no certificate file paths, no Let's Encrypt integration, no HTTPS redirect middleware. For production, you would need to either:

  • Use a reverse proxy (nginx, Caddy, etc.) to terminate TLS in front of the application
  • Configure Kestrel with a real certificate via appsettings.json or environment variables

Ports

Port Service Configurable
5001 ASP.NET Core (HTTPS) Via launchSettings.json or Kestrel config
5000 ASP.NET Core (HTTP) Via launchSettings.json or Kestrel config
5432 PostgreSQL Via docker-compose.yml port mapping

SSE runs over the same HTTP/HTTPS connection — no additional ports are required.

Changing the API port

Modify Properties/launchSettings.json in the API project, or set the ASPNETCORE_URLS environment variable:

ASPNETCORE_URLS=https://localhost:6001 dotnet watch --project src/TechStrat.Api

Logging

The application uses ASP.NET Core's built-in ILogger with structured logging. Key log points:

Component What is logged
EventEndpoints Event applied/rejected, checkpoints, restores
SseConnectionManager Connection open/close
AuthEndpoints Login success/failure/lockout
ProcessorInitializer Cold start progress (checkpoint load, replay count)

Configure log levels in appsettings.json:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  }
}

Health Check

GET /health returns a basic health response:

{
  "status": "healthy"
}

This endpoint does not check database connectivity — it only confirms the application is running and accepting requests.

Production Readiness

This project is currently development-only. There is no production deployment infrastructure:

  • No Dockerfile for the .NET application
  • No production docker-compose.yml (the existing one is for PostgreSQL dev only)
  • No CI/CD pipeline (no GitHub Actions, Azure DevOps, or deployment scripts)
  • No appsettings.Production.json
  • No reverse proxy configuration

For a production deployment, you would need to:

  1. Create a Dockerfile for the .NET application
  2. Set up TLS termination (reverse proxy or Kestrel certificate)
  3. Use a production PostgreSQL instance with real credentials
  4. Configure the connection string via environment variables
  5. Apply EF Core migrations via a deployment pipeline (auto-migration is disabled outside Development)
  6. Create the initial admin user manually (user seeding is disabled outside Development)

Summary of Configuration Sources

Setting Source Override
Connection string appsettings.Development.json Environment variable
API port launchSettings.json ASPNETCORE_URLS env var
Log levels appsettings.json Environment-specific config
PostgreSQL port docker-compose.yml Edit file directly
Auto-migration Gated on IsDevelopment() Set ASPNETCORE_ENVIRONMENT
User seeding Gated on IsDevelopment() Set ASPNETCORE_ENVIRONMENT
All other settings Hardcoded (see table above) Requires code change