Skip to content

Commit

Permalink
Merge pull request #23 from aserto-dev/dial-options
Browse files Browse the repository at this point in the history
Allow extra dial options in NewDialOptionsProvider
  • Loading branch information
ronenh committed May 7, 2024
2 parents 72fd662 + 796b3b8 commit ef8703d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions client/dial_options_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import (

type DialOptionsProvider func(*Config) ([]grpc.DialOption, error)

func NewDialOptionsProvider() DialOptionsProvider {
func NewDialOptionsProvider(dialopts ...grpc.DialOption) DialOptionsProvider {
return func(cfg *Config) ([]grpc.DialOption, error) {
if (cfg.ClientCertPath != "") != (cfg.ClientKeyPath != "") {
return nil, errors.New("both client cert and key must be specified, or both must be empty")
}

dialopts := []grpc.DialOption{}

if cfg.ClientCertPath != "" {
certificate, err := tls.LoadX509KeyPair(cfg.ClientCertPath, cfg.ClientKeyPath)
if err != nil {
Expand Down

0 comments on commit ef8703d

Please sign in to comment.