From 74aef4ea06a651f57acb3f670ebb3b7c9ccff91e Mon Sep 17 00:00:00 2001 From: Mathias Beaulieu-Duncan Date: Tue, 20 Jan 2026 12:48:23 -0500 Subject: [PATCH] auto-claude: subtask-1-2 - Create GrpcConfig class with development/production configs Add GrpcConfig class following the pattern from ApiClientConfig with: - Development config: 192.168.88.228:5011 (plaintext/insecure) - Production config: grpc-route.goutezplanb.com:443 (TLS) - Host, port, timeout, useTls, and allowSelfSignedCertificate properties - Address getter for convenience Co-Authored-By: Claude --- lib/api/grpc_config.dart | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 lib/api/grpc_config.dart diff --git a/lib/api/grpc_config.dart b/lib/api/grpc_config.dart new file mode 100644 index 0000000..5266109 --- /dev/null +++ b/lib/api/grpc_config.dart @@ -0,0 +1,59 @@ +/// Configuration for gRPC client connections. +/// +/// Provides separate configurations for development and production environments +/// with appropriate security settings for each. +class GrpcConfig { + /// The gRPC server host address. + final String host; + + /// The gRPC server port. + final int port; + + /// Connection timeout duration. + final Duration timeout; + + /// Whether to use TLS for secure connections. + /// + /// When false, uses insecure (plaintext) credentials suitable only for + /// development environments. + final bool useTls; + + /// Whether to allow self-signed certificates. + /// + /// Only applicable when [useTls] is true. Useful for development + /// environments with self-signed certificates. + final bool allowSelfSignedCertificate; + + const GrpcConfig({ + required this.host, + required this.port, + this.timeout = const Duration(seconds: 30), + this.useTls = true, + this.allowSelfSignedCertificate = false, + }); + + /// Development configuration pointing to local/development gRPC server. + /// + /// Uses plaintext (insecure) credentials for development convenience. + static const GrpcConfig development = GrpcConfig( + host: '192.168.88.228', + port: 5011, + timeout: Duration(seconds: 30), + useTls: false, + allowSelfSignedCertificate: true, + ); + + /// Production configuration for the Plan B Logistics gRPC server. + /// + /// Uses TLS for secure communication. + static const GrpcConfig production = GrpcConfig( + host: 'grpc-route.goutezplanb.com', + port: 443, + timeout: Duration(seconds: 30), + useTls: true, + allowSelfSignedCertificate: false, + ); + + /// Returns the full address string in the format "host:port". + String get address => '$host:$port'; +}