Skip to content

Commit

Permalink
Merge "[FAB-5319] peer cli orderer TLS hostname override"
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristidis authored and Gerrit Code Review committed Jul 19, 2017
2 parents 10626e3 + c60d859 commit a3f2a02
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions peer/channel/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ var (
genesisBlockPath string

// create related variables
chainID string
channelTxFile string
orderingEndpoint string
tls bool
caFile string
timeout int
chainID string
channelTxFile string
orderingEndpoint string
tls bool
caFile string
ordererTLSHostnameOverride string
timeout int
)

// Cmd returns the cobra command for Node
Expand All @@ -83,6 +84,7 @@ func AddFlags(cmd *cobra.Command) {
flags.StringVarP(&orderingEndpoint, "orderer", "o", "", "Ordering service endpoint")
flags.BoolVarP(&tls, "tls", "", false, "Use TLS when communicating with the orderer endpoint")
flags.StringVarP(&caFile, "cafile", "", "", "Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint")
flags.StringVarP(&ordererTLSHostnameOverride, "ordererTLSHostnameOverride", "", "", "The hostname override to use when validating the TLS connection to the orderer.")
}

var flags *pflag.FlagSet
Expand Down Expand Up @@ -162,7 +164,7 @@ func InitCmdFactory(isEndorserRequired EndorserRequirement, isOrdererRequired Or
// check for TLS
if tls {
if caFile != "" {
creds, err := credentials.NewClientTLSFromFile(caFile, "")
creds, err := credentials.NewClientTLSFromFile(caFile, ordererTLSHostnameOverride)
if err != nil {
return nil, fmt.Errorf("Error connecting to %s due to %s", orderingEndpoint, err)
}
Expand Down

0 comments on commit a3f2a02

Please # to comment.