Documentation ¶
Index ¶
- Constants
- Variables
- func Get(name string) (string, error)
- func GetToken() (*oauth2.Token, error)
- func GetWithDefault(name, defaultValue string) string
- func Must(s string, err error) string
- func MustGet(keyname string) string
- func NSQDTestServerAddr() string
- func ProjectGet(name string) (string, error)
- func ProjectGetWithDefault(name, defaultValue string) string
Constants ¶
View Source
const ( // APIKEY is used for access to APIs that don't need OAuth 2.0. APIKEY = "apikey" // COOKIESALT, CLIENT_ID, and CLIENT_SECRET are used for login. COOKIESALT = "cookiesalt" CLIENT_ID = "client_id" CLIENT_SECRET = "client_secret" // GMAIL_CACHED_TOKEN, GMAIL_CLIENT_ID, and GMAIL_CLIENT_SECRET are used for sending mail // from alerts@skia.org. GMAIL_CACHED_TOKEN = "gmail_cached_token" GMAIL_CACHED_TOKEN_AUTOROLL = "gmail_cached_token_autoroll" GMAIL_CLIENT_ID = "gmail_clientid" GMAIL_CLIENT_SECRET = "gmail_clientsecret" // METADATA_PATH_PREFIX_TMPL is the template for the first part of the // metadata URL. The placeholder is for the level ("instance" or // "project"). METADATA_PATH_PREFIX_TMPL = "/computeMetadata/v1/%s" // METADATA_SUB_URL_TMPL is the URL template for metadata. The // placeholders are for the level ("instance" or "project") and the // metadata key. METADATA_SUB_URL_TMPL = METADATA_PATH_PREFIX_TMPL + "/attributes/%s" // METADATA_URL_PREFIX is the prefix of the metadata URL. METADATA_URL_PREFIX = "http://metadata" // METADATA_URL is the URL template for metadata. The placeholders are // for the level ("instance" or "project") and the metadata key. METADATA_URL = METADATA_URL_PREFIX + METADATA_SUB_URL_TMPL // WEBHOOK_REQUEST_SALT is used to authenticate webhook requests. The value stored in // Metadata is base64-encoded. // Value created 2015-08-10 with // dd if=/dev/random iflag=fullblock bs=64 count=1 | base64 -w 0 WEBHOOK_REQUEST_SALT = "webhook_request_salt" // JWT_SERVICE_ACCOUNT is the JSON formatted service account. JWT_SERVICE_ACCOUNT = "jwt_service_account" // NSQ_TEST_SERVER refers to a test server in GCE which runs NSQ for testing purposes. NSQ_TEST_SERVER = "nsq-test-server" // Metadata levels. LEVEL_INSTANCE = "instance" LEVEL_PROJECT = "project" // The "Metadata-Flavor: Google" header must be set for HTTP requests // to the metadata server. HEADER_MD_FLAVOR_KEY = "Metadata-Flavor" HEADER_MD_FLAVOR_VAL = "Google" )
GCE project level metadata keys.
Variables ¶
View Source
var ( // Metadata path for a default service account token. TOKEN_PATH = fmt.Sprintf(METADATA_PATH_PREFIX_TMPL, LEVEL_INSTANCE) + "/service-accounts/default/token" // Full metadata URL for a default service account token. TOKEN_URL = METADATA_URL_PREFIX + TOKEN_PATH )
Functions ¶
func Get ¶
Get retrieves the named value from the instance Metadata server. See https://developers.google.com/compute/docs/metadata
func GetWithDefault ¶
GetWithDefault is Get, but returns the default value on error.
func NSQDTestServerAddr ¶
func NSQDTestServerAddr() string
NSQDTestServerAddr returns the address of a test NSQD server used for testing. If not running in GCE, this is the local machine.
func ProjectGet ¶
ProjectGet retrieves the named value from the project Metadata server. See https://developers.google.com/compute/docs/metadata
func ProjectGetWithDefault ¶
ProjectGetWithDefault is ProjectGet, but returns the default value on error.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.