Skip to content

Commit 117231a

Browse files
Merge pull request #374 from depot/fix-cargo-cache-token
2 parents 4cc2ce0 + 53a7f3c commit 117231a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/cmd/cargo/cargo.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"syscall"
1010

11+
"github.com/depot/cli/pkg/cmd/gocache"
1112
"github.com/depot/cli/pkg/config"
1213
"github.com/depot/cli/pkg/helpers"
1314
"github.com/spf13/cobra"
@@ -52,7 +53,8 @@ func NewCmdCargo() *cobra.Command {
5253
}
5354

5455
// Get authentication token
55-
token, err := helpers.ResolveToken(ctx, "")
56+
token := os.Getenv("DEPOT_CACHE_TOKEN")
57+
token, err = helpers.ResolveToken(ctx, token)
5658
if err != nil {
5759
return fmt.Errorf("failed to resolve token: %w", err)
5860
}
@@ -72,9 +74,14 @@ func NewCmdCargo() *cobra.Command {
7274
}
7375
}
7476

77+
cacheHost := os.Getenv("DEPOT_CACHE_HOST")
78+
if cacheHost == "" {
79+
cacheHost = gocache.DefaultCacheHost
80+
}
81+
7582
// Now add our sccache vars
7683
cargoCmd.Env = append(cargoCmd.Env, fmt.Sprintf("RUSTC_WRAPPER=%s", sccachePath))
77-
cargoCmd.Env = append(cargoCmd.Env, "SCCACHE_WEBDAV_ENDPOINT=https://cache.depot.dev")
84+
cargoCmd.Env = append(cargoCmd.Env, fmt.Sprintf("SCCACHE_WEBDAV_ENDPOINT=%s", cacheHost))
7885

7986
if orgID != "" {
8087
// Use org-specific authentication

0 commit comments

Comments
 (0)