env

package
v0.0.0-...-08046e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(
	env *Env,
) func(http.Handler) http.Handler

Middleware returns a middleware that injects the specified Env in requests.

func With

func With(
	ctx context.Context,
	env *Env,
) context.Context

With stores the environment in the provided context.

Types

type ConfigKey

type ConfigKey string

ConfigKey is the type of a config entry key.

type ContextKey

type ContextKey string

ContextKey is the type of the key used with context to carry contextual environment.

type Env

type Env struct {
	Environment Environment
	Config      map[ConfigKey]string
}

Env is the value stored in context that stores the current environment along with configuration values.

func Get

func Get(
	ctx context.Context,
) *Env

Get returns the env currently stored in the context.

type Environment

type Environment string

Environment is the type of the possible environment values.

const (
	// Production is the production environment.
	Production Environment = "prod"
	// QA is the qa environment.
	QA Environment = "qa"
)

Jump to

Keyboard shortcuts

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