Skip to content

Commit f404049

Browse files
Refactor client initialization for code intel upload (#1256)
Will share update here from the customer after they test this * Refactor client initialization for code intel upload ### Problem The `src code-intel upload` command does not respect the `SRC_PROXY` environment variable, preventing uploads through corporate proxies. This also means standard `HTTP_PROXY`/`HTTPS_PROXY` environment variables are not honored. **Customer Impact**: Dropbox reported they can successfully upload code intelligence indexes from local machines, but uploads fail from their CI system which requires outbound proxy configuration. The `SRC_PROXY` environment variable works for `src search` and other commands, but not for `src code-intel upload`. ### Root Cause In `cmd/src/code_intel_upload.go:79-82`, the API client was constructed directly with `api.NewClient()`, passing only `Out` and `Flags`. This bypassed the global configuration object which contains: - Endpoint - Access token - Additional headers - **Proxy URL and proxy path** (parsed from `SRC_PROXY` environment variable) Other commands use the `cfg.apiClient()` helper method which properly includes all configuration. ### Fix Replace the manual `api.NewClient()` construction with `cfg.apiClient()`, ensuring the code-intel upload command uses the same fully-configured client as all other commands. * fixup --------- Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
1 parent 1ecebe6 commit f404049

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

cmd/src/code_intel_upload.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import (
1818
"github.com/sourcegraph/sourcegraph/lib/codeintel/upload"
1919
"github.com/sourcegraph/sourcegraph/lib/errors"
2020
"github.com/sourcegraph/sourcegraph/lib/output"
21-
22-
"github.com/sourcegraph/src-cli/internal/api"
2321
)
2422

2523
func init() {
@@ -76,10 +74,7 @@ func handleCodeIntelUpload(args []string) error {
7674
return handleUploadError(cfg.AccessToken, err)
7775
}
7876

79-
client := api.NewClient(api.ClientOpts{
80-
Out: io.Discard,
81-
Flags: codeintelUploadFlags.apiFlags,
82-
})
77+
client := cfg.apiClient(codeintelUploadFlags.apiFlags, io.Discard)
8378

8479
uploadOptions := codeintelUploadOptions(out)
8580
var uploadID int

0 commit comments

Comments
 (0)