in cmd/redirector/referer.go [29:68]
func prepURL(r repoRef, overrides url.Values) string {
u := &url.URL{
Scheme: "https",
Host: "console.cloud.google.com",
Path: "cloudshell/editor",
}
q := make(url.Values)
// not an officially documented param:
// https://cloud.google.com/shell/docs/open-in-cloud-shell
q.Set("shellonly", "true")
q.Set("cloudshell_image", "gcr.io/cloudrun/button")
q.Set("cloudshell_git_repo", r.GitURL())
if v := r.Ref(); v != "" {
q.Set("cloudshell_git_branch", v)
}
if v := r.Dir(); v != "" {
q.Set("cloudshell_working_dir", v)
}
// overrides
if v := overrides.Get(paramRepo); v != "" {
q.Set("cloudshell_git_repo", v)
}
if v := overrides.Get(paramDir); v != "" {
q.Set("cloudshell_working_dir", v)
}
if v := overrides.Get(paramRev); v != "" {
q.Set("cloudshell_git_branch", v)
}
// pass-through query parameters
for k := range overrides {
if strings.HasPrefix(k, "cloudshell_") {
q.Set(k, overrides.Get(k))
}
}
u.RawQuery = q.Encode()
return u.String()
}