Skip to content

Commit

Permalink
Merge pull request #516 from ripienaar/certstore_validate
Browse files Browse the repository at this point in the history
Only set win options when set
  • Loading branch information
ripienaar authored Jan 8, 2024
2 parents 2cec12d + e44e23e commit 6d6040d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions natscontext/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,9 @@ func (c *Context) TLSHandshakeFirst() bool {
// WithWindowsCertStore configures TLS to use a Windows Certificate Store. Valid values are "user" or "machine"
func WithWindowsCertStore(storeType string) Option {
return func(s *settings) {
s.WinCertStoreType = storeType
if storeType != "" {
s.WinCertStoreType = storeType
}
}
}

Expand All @@ -944,7 +946,9 @@ func (c *Context) WindowsCertStore() string { return c.config.WinCertStoreType }
// WithWindowsCertStoreMatchBy configures Matching behavior for Windows Certificate Store. Valid values are "issuer" or "subject"
func WithWindowsCertStoreMatchBy(matchBy string) Option {
return func(s *settings) {
s.WinCertStoreMatchBy = matchBy
if matchBy != "" {
s.WinCertStoreMatchBy = matchBy
}
}
}

Expand All @@ -954,7 +958,9 @@ func (c *Context) WindowsCertStoreMatchBy() string { return c.config.WinCertStor
// WithWindowsCertStoreMatch configures the matcher query to select certificates with, see WithWindowsCertStoreMatchBy
func WithWindowsCertStoreMatch(match string) Option {
return func(s *settings) {
s.WinCertStoreMatch = match
if match != "" {
s.WinCertStoreMatch = match
}
}
}

Expand Down

0 comments on commit 6d6040d

Please sign in to comment.