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:
- Environment variables (loaded first)
- 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 |
Instance Heartbeat
The InstanceHeartbeatService publishes this pod's heartbeat to the
Dapr state store and discovers peer heartbeats, so the
ConnectionReclaimerHostedService doesn't reclaim connections from
live pods (see Security: Pod replacement orphan risk
for the scenario this addresses).
| Key | Description | Default | Range |
|---|---|---|---|
INSTANCE_HEARTBEAT_INTERVAL_SECONDS |
How often this pod publishes its heartbeat. Set to 0 to disable heartbeat-based detection (fall back to TTL-based reclamation only). |
10 |
0–3600 |
INSTANCE_DISCOVERY_INTERVAL_SECONDS |
How often this pod polls for peer heartbeats. | 30 |
1–3600 |
INSTANCE_STALE_THRESHOLD_SECONDS |
A peer whose heartbeat is older than this is considered dead; its connections are reclaim candidates. | 60 |
5–86400 |
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.