gcp

package
v0.0.0-...-6c0bb26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProjectID string `envconfig:"GCP_PROJECT_ID"`

	// JSONAuthPath points to a file containing a JWT JSON config.
	// This is meant to be a fall back for development environments.
	JSONAuthPath string `envconfig:"GCP_JSON_AUTH_PATH"`

	// Token is a JWT JSON config and may be needed for container
	// environments.
	Token string `envconfig:"GCP_AUTH_TOKEN"`

	// FlexibleVM tells the config we are using a 'flexible' App Engine VM
	// and to use appengine.BackgroundContext()
	FlexibleVM bool `envconfig:"GCP_FLEXIBLE_VM"`
}

Config holds common Google Cloud Platform credentials.

func LoadConfigFromEnv

func LoadConfigFromEnv() Config

LoadConfigFromEnv will attempt to load a GCP config from environment variables.

func (Config) ClientOption

func (g Config) ClientOption(scopes ...string) (option.ClientOption, error)

ClientOption will attempt create a new option.ClientOption from a the Token or JSONAuthPath fields if provided. If the FlexibleAE flag is set to designate this is a 'flexible' App Engine VM, just the scope passed in will be used. Otherwise, this function assumes you're running on GCE and tacks on a compute.ComputeScope.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL