bootstrap

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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

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

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

Functions

This section is empty.

Types

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.

Jump to

Keyboard shortcuts

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