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 (
1212const (
1313 RunXScheme = "runx"
1414 RunXPrefix = RunXScheme + ":"
15- githubAPITokenVarName = "DEVBOX_GITHUB_API_TOKEN"
15+ githubAPITokenVarName = "GITHUB_TOKEN"
16+ // TODO: Keep for backwards compatibility
17+ oldGithubAPITokenVarName = "DEVBOX_GITHUB_API_TOKEN"
1618)
1719
1820var cachedRegistry * registry.Registry
@@ -23,17 +25,25 @@ func IsRunX(s string) bool {
2325
2426func RunXClient () * runx.RunX {
2527 return & runx.RunX {
26- GithubAPIToken : os . Getenv ( githubAPITokenVarName ),
28+ GithubAPIToken : getGithubToken ( ),
2729 }
2830}
2931
3032func RunXRegistry (ctx context.Context ) (* registry.Registry , error ) {
3133 if cachedRegistry == nil {
3234 var err error
33- cachedRegistry , err = registry .NewLocalRegistry (ctx , os . Getenv ( githubAPITokenVarName ))
35+ cachedRegistry , err = registry .NewLocalRegistry (ctx , getGithubToken ( ))
3436 if err != nil {
3537 return nil , err
3638 }
3739 }
3840 return cachedRegistry , nil
3941}
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