Configuration
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 for REST APIs | 5001 |
GrpcPort |
gRPC port for gRPC services | 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 |
Environment Variables
Set configuration using environment variables:
export HttpPort=8080
export GrpcPort=8081
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 8081
Available Arguments
| Argument | Short | Description | Default |
|---|---|---|---|
--http-port <port> |
-h |
HTTP port for REST APIs | 5001 |
--grpc-port <port> |
-g |
gRPC port for gRPC services | 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> |
-s |
State store component name | statestore |
--help |
-? |
Show help message |
Examples
Using Environment Variables
export HttpPort=3000
export GrpcPort=3001
./Virtufin.WebSocketManager
Using Command-Line Arguments
./Virtufin.WebSocketManager --http-port 3000 --grpc-port 3001 --log-level Debug
Combining Both
Environment variables set defaults, command-line arguments override:
export HttpPort=3000
./Virtufin.WebSocketManager --grpc-port 3001
In this example, HttpPort is 3000 (from environment) and GrpcPort is 3001 (from command line).
Validation
The application validates port values on startup:
- HTTP and gRPC ports must be between 1 and 65535
- HTTP and gRPC ports must be different
If validation fails, the application writes an error message to stderr and exits with code 1.