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) +}