Back to godoc.org

Package bootstrap

v0.0.0-...-d4769a7
Latest Go to latest

The highest tagged major version is .

Published: Aug 1, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Index

Constants

const (
	// EnvStreamServerPath is the path to the Butler's stream server endpoint.
	//
	// This can be used by applications to initiate a new Butler stream with an
	// existing Butler stream server process. If a subprocess is launched with a
	// stream server configuration, it will propagate this path to its child
	// processes.
	EnvStreamServerPath = "LOGDOG_STREAM_SERVER_PATH"

	// EnvStreamProject is the environment variable set to the configured stream
	// project name.
	EnvStreamProject = "LOGDOG_STREAM_PROJECT"

	// EnvStreamPrefix is the environment variable set to the configured
	// stream name prefix.
	EnvStreamPrefix = "LOGDOG_STREAM_PREFIX"

	// EnvCoordinatorHost is the environment variable set to the host name of
	// the upstream Coordinator service.
	EnvCoordinatorHost = "LOGDOG_COORDINATOR_HOST"

	// EnvNamespace is the environment variable set to the stream namespace that
	// all streams should be created within.
	EnvNamespace = "LOGDOG_NAMESPACE"
)

Environment variable names

Variables

var ErrNotBootstrapped = errors.New("not bootstrapped")

ErrNotBootstrapped is returned by Get when the current process is not bootstrapped.

type Bootstrap

type Bootstrap struct {
	// CoordinatorHost is the name of the upstream Coordinator host.
	//
	// This is just the host name ("example.appspot.com"), not a full URL.
	//
	// If this instance is not configured using a production Coordinator Output,
	// this will be empty.
	CoordinatorHost string

	// Project is the Butler instance project name.
	Project string
	// Prefix is the Butler instance prefix.
	Prefix types.StreamName
	// Namespace is prefix for stream names.
	Namespace types.StreamName

	// Client is the streamclient for this instance, or nil if the Butler has no
	// streamserver.
	Client *streamclient.Client
}

Bootstrap contains information about the configured bootstrap environment.

The bootstrap environment is loaded by probing the local application environment for variables emitted by a bootstrapping Butler.

func Get

func Get() (*Bootstrap, error)

Get is shorthand for `GetFromEnv(environ.System())`.

func GetFromEnv

func GetFromEnv(env environ.Env) (*Bootstrap, error)

GetFromEnv loads a Bootstrap instance from the given environment.

It will return an error if the bootstrap data is invalid, and will return ErrNotBootstrapped if the current process is not bootstrapped.

func (*Bootstrap) GetViewerURL

func (bs *Bootstrap) GetViewerURL(paths ...types.StreamPath) (string, error)

GetViewerURL returns a log stream viewer URL to the aggregate set of supplied stream paths.

If both the Project and CoordinatorHost values are not populated, an error will be returned.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier