Skip to content

Commit 0ffc9fc

Browse files
committed
Configure git to use the certificate, if needed
1 parent 69ca66e commit 0ffc9fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go/extractor/util/registryproxy.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ func getEnvVars() []string {
129129

130130
if len(git_sources) > 0 {
131131
goprivate = append(goprivate, git_sources...)
132+
133+
if proxy_cert_file != "" {
134+
slog.Info("Configuring `git` to use proxy certificate", slog.String("path", proxy_cert_file))
135+
cmd := exec.Command("git", "config", "--global", "http.sslCAInfo", proxy_cert_file)
136+
137+
out, cmdErr := cmd.CombinedOutput()
138+
slog.Info(string(out))
139+
140+
if cmdErr != nil {
141+
slog.Error("Failed to configure `git` to accept the certificate file", slog.String("error", cmdErr.Error()))
142+
}
143+
}
132144
}
133145

134146
result = append(result, fmt.Sprintf("GOPRIVATE=%s", strings.Join(goprivate, ",")))

0 commit comments

Comments
 (0)