Skip to content

Commit

Permalink
CHat server Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMartynenko committed Mar 12, 2024
1 parent 5e46aca commit 3f55924
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/config/env/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package env
import (
"errors"
"github.com/AndreiMartynenko/chat-server/internal/config"
"net"
"os"
)

Expand All @@ -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")
Expand All @@ -36,3 +37,8 @@ func GRPCConfig() (*grpcConfig, error) {
port: port,
}, nil
}

// Address
func (cfg *grpcConfig) Address() string {
return net.JoinHostPort(cfg.host, cfg.port)
}

0 comments on commit 3f55924

Please sign in to comment.