From 3f5592458bbff556feda42807655389510c6db19 Mon Sep 17 00:00:00 2001 From: AndrewLondon Date: Tue, 12 Mar 2024 20:36:50 +0000 Subject: [PATCH] CHat server Updated --- internal/config/env/grpc.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/config/env/grpc.go b/internal/config/env/grpc.go index 2fc7120..475640b 100644 --- a/internal/config/env/grpc.go +++ b/internal/config/env/grpc.go @@ -3,6 +3,7 @@ package env import ( "errors" "github.com/AndreiMartynenko/chat-server/internal/config" + "net" "os" ) @@ -20,7 +21,7 @@ type grpcConfig struct { // NewGRPCConfig -func GRPCConfig() (*grpcConfig, error) { +func NewGRPCConfig() (*grpcConfig, error) { host := os.Getenv(grpcHostEnvName) if len(host) == 0 { return nil, errors.New("grpc host not found") @@ -36,3 +37,8 @@ func GRPCConfig() (*grpcConfig, error) { port: port, }, nil } + +// Address +func (cfg *grpcConfig) Address() string { + return net.JoinHostPort(cfg.host, cfg.port) +}