Skip to content

Commit

Permalink
ostree: skip MTLS on nil
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and mvo5 committed Nov 14, 2024
1 parent 43dc4df commit 2b23643
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/ostree/ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func resolveRef(ss SourceSpec) (string, error) {
}

// If CA is set, load the CA certificate and add it to the TLS configuration. Otherwise, use the system CA.
if ss.MTLS.CA != "" {
if ss.MTLS != nil && ss.MTLS.CA != "" {
caCertPEM, err := os.ReadFile(ss.MTLS.CA)
if err != nil {
return "", NewResolveRefError("error adding ca certificate when resolving ref: %s", err)
Expand All @@ -182,7 +182,7 @@ func resolveRef(ss SourceSpec) (string, error) {
}
}

if ss.MTLS.ClientCert != "" && ss.MTLS.ClientKey != "" {
if ss.MTLS != nil && ss.MTLS.ClientCert != "" && ss.MTLS.ClientKey != "" {
cert, err := tls.LoadX509KeyPair(ss.MTLS.ClientCert, ss.MTLS.ClientKey)
if err != nil {
return "", NewResolveRefError("error adding client certificate when resolving ref: %s", err)
Expand Down

0 comments on commit 2b23643

Please sign in to comment.