| // Copyright 2018 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Package status contains code for monitoring the golang.org infrastructure. |
| // It is not intended for use outside of the Go project. |
| "cloud.google.com/go/compute/metadata" |
| // UpdateToken returns the value of "monitor-probe-token" from the GCE |
| // metadata server, or from the environment variable |
| // $DEV_STATUS_UPDATE_TOKEN. This is the the shared secret that must |
| // be sent to dev.golang.org in prober status update requests. |
| // Most probers will not use this directly. |
| func UpdateToken() (string, error) { |
| defer statusTokenMu.Unlock() |
| if statusTokenVal != "" { |
| return statusTokenVal, nil |
| if lastCheck.After(time.Now().Add(-10 * time.Second)) { |
| return "", statusTokenErr |
| if v := os.Getenv("DEV_STATUS_UPDATE_TOKEN"); v != "" { |
| v, err := metadata.Get("monitor-probe-token") |