Skip to content

Configuration

Requirements: Dapr 1.18+ with mTLS enabled. .NET 10.0 SDK.

WebSocketManager supports configuration via environment variables and command-line arguments. Both methods are supported with consistent behavior across all Virtufin projects.

Precedence

Configuration is loaded in the following order:

  1. Environment variables (loaded first)
  2. Command-line arguments (loaded second)

Command-line arguments take precedence over environment variables.

Configuration Keys

Port Configuration

Key Description Default
HttpPort HTTP port (REST, Swagger, health) 5001
GrpcPort gRPC port (native gRPC HTTP/2 h2c) 5002
DaprHttpPort Dapr HTTP port 3500
DaprGrpcPort Dapr gRPC port 50001

Logging

Key Description Default
Logging:LogLevel:Default Minimum log level Information

Valid log levels: Trace, Debug, Information, Warning, Error, Critical, None

Dapr Configuration

Key Description Default
pubsubName Pub/sub component name pubsub
stateStoreName State store component name statestore

Connection record TTL

Key Description Default Range
CONNECTION_RECORD_TTL_SECONDS Dapr state TTL on connection records. A background connection heartbeat (distinct from the peer-discovery heartbeat used for RPC forwarding, see Services) refreshes every locally-owned, connected record every TTL/3 seconds (floored at 10s), independent of Send/SendRaw traffic. Send/SendRaw also refresh it as a side effect. A pod that dies without a clean disconnect stops refreshing its connections' records, which then expire and are removed by the state store. 300 303600

Environment Variables

Set configuration using environment variables:

export HttpPort=8080
export GrpcPort=5002
export DaprHttpPort=3500
export DaprGrpcPort=50001
export Logging:LogLevel:Default=Debug
export pubsubName=my-pubsub
export stateStoreName=my-state

Command-Line Arguments

Pass arguments when running the application:

Virtufin.WebSocketManager --http-port 8080 --grpc-port 5002

Available Arguments

Argument Short Description Default
--http-port <port> -s HTTP port (REST, Swagger, health) 5001
--grpc-port <port> -g gRPC port (native gRPC HTTP/2 h2c) 5002
--dapr-http-port <port> Dapr HTTP port 3500
--dapr-grpc-port <port> Dapr gRPC port 50001
--log-level <level> -l Minimum log level Information
--pubsub-name <name> -n Pub/sub component name pubsub
--state-store-name <name> -t State store component name statestore
--help -? Show help message

Examples

Using Environment Variables

export HttpPort=3000
export GrpcPort=3002
./Virtufin.WebSocketManager

Using Command-Line Arguments

./Virtufin.WebSocketManager --http-port 3000 --grpc-port 3002 --log-level Debug

Combining Both

Environment variables set defaults, command-line arguments override:

export HttpPort=3000
./Virtufin.WebSocketManager --grpc-port 3002

In this example, HttpPort is 3000 (from environment) and GrpcPort is 3002 (from command line).

Validation

The application validates port values on startup:

  • Ports must be between 1 and 65535

If validation fails, the application writes an error message to stderr and exits with code 1.