diff --git a/pkg/server/status.go b/pkg/server/status.go index ec743c89f..fef78f282 100644 --- a/pkg/server/status.go +++ b/pkg/server/status.go @@ -18,6 +18,7 @@ package server import ( "encoding/json" + "errors" "fmt" "html" "io" @@ -40,6 +41,8 @@ import ( "camlistore.org/pkg/server/app" "camlistore.org/pkg/types/camtypes" "go4.org/jsonconfig" + + "google.golang.org/cloud/compute/metadata" ) // StatusHandler publishes server status information. @@ -208,6 +211,17 @@ func (sh *StatusHandler) serveStatusJSON(rw http.ResponseWriter, req *http.Reque httputil.ReturnJSON(rw, sh.currentStatus()) } +func (sh *StatusHandler) googleCloudConsole() (string, error) { + if !env.OnGCE() { + return "", errors.New("not on GCE") + } + projID, err := metadata.ProjectID() + if err != nil { + return "", fmt.Errorf("Error getting project ID: %v", err) + } + return "https://console.cloud.google.com/compute/instances?project=" + projID, nil +} + var quotedPrefix = regexp.MustCompile(`[;"]/(\S+?/)[&"]`) func (sh *StatusHandler) serveStatusHTML(rw http.ResponseWriter, req *http.Request) { @@ -243,8 +257,18 @@ func (sh *StatusHandler) serveStatusHTML(rw http.ResponseWriter, req *http.Reque f("") f("
As JSON: status.json; and the discovery JSON.
", st.rootPrefix)