env

package
v2.25.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const EnvironmentKey = "ENVIRONMENT"

EnvironmentKey is the environment variable we look for to set the environment (prefixed with service name)

Variables

View Source
var Module = fx.Module(
	"env",
	fx.Provide(
		Env,
		NewEnviron,
	),
)

Functions

This section is empty.

Types

type Environ

type Environ interface {
	Getenv(key string) string
}

func NewEnviron

func NewEnviron(prefix service.Name) Environ

type Environment

type Environment string

Environment is a defined environment

func Env

func Env(environ Environ) Environment

Env returns the environment from the environment variables

func Local added in v2.2.0

func Local() Environment

func Production added in v2.2.0

func Production() Environment

func Test added in v2.2.0

func Test() Environment

func (Environment) IsLocal

func (e Environment) IsLocal() bool

IsLocal returns true if the environment is not defined (aka local)

func (Environment) IsProduction

func (e Environment) IsProduction() bool

IsProduction returns true if the environment is the production environment.

func (Environment) IsTest

func (e Environment) IsTest() bool

IsTest returns true if the environment is the test environment

func (Environment) Load

func (e Environment) Load(files ...string)

Load loads the environment variables from the specified files and from the standard locations

func (Environment) String

func (e Environment) String() string

String returns a string version of the environment.

Jump to

Keyboard shortcuts

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