File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ import (
12
12
const (
13
13
RunXScheme = "runx"
14
14
RunXPrefix = RunXScheme + ":"
15
- githubAPITokenVarName = "DEVBOX_GITHUB_API_TOKEN"
15
+ githubAPITokenVarName = "GITHUB_TOKEN"
16
+ // Keep for backwards compatibility
17
+ oldGithubAPITokenVarName = "DEVBOX_GITHUB_API_TOKEN"
16
18
)
17
19
18
20
var cachedRegistry * registry.Registry
@@ -23,17 +25,25 @@ func IsRunX(s string) bool {
23
25
24
26
func RunXClient () * runx.RunX {
25
27
return & runx.RunX {
26
- GithubAPIToken : os . Getenv ( githubAPITokenVarName ),
28
+ GithubAPIToken : getGithubToken ( ),
27
29
}
28
30
}
29
31
30
32
func RunXRegistry (ctx context.Context ) (* registry.Registry , error ) {
31
33
if cachedRegistry == nil {
32
34
var err error
33
- cachedRegistry , err = registry .NewLocalRegistry (ctx , os . Getenv ( githubAPITokenVarName ))
35
+ cachedRegistry , err = registry .NewLocalRegistry (ctx , getGithubToken ( ))
34
36
if err != nil {
35
37
return nil , err
36
38
}
37
39
}
38
40
return cachedRegistry , nil
39
41
}
42
+
43
+ func getGithubToken () string {
44
+ token := os .Getenv (githubAPITokenVarName )
45
+ if token == "" {
46
+ token = os .Getenv (oldGithubAPITokenVarName )
47
+ }
48
+ return token
49
+ }
You can’t perform that action at this time.
0 commit comments