Documentation ¶
Overview ¶
Package environment provides basic environment definitions
Index ¶
- func Supports(env Environment, components ...interface{}) ([]interface{}, bool)
- func Variable(name, defaultValue string) string
- type Environment
- func (e Environment) AllowTestData() bool
- func (e Environment) GetIdentifier() string
- func (e Environment) IsDevOrTest() bool
- func (e Environment) IsDevelopment() bool
- func (e Environment) IsIntegrationTest() bool
- func (e Environment) IsLocal() bool
- func (e Environment) IsProduction() bool
- func (e Environment) IsSandbox() bool
- func (e Environment) IsTestCase() bool
- func (e Environment) IsUnitTest() bool
- type Name
- type Supporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Supports ¶
func Supports(env Environment, components ...interface{}) ([]interface{}, bool)
Supports returns a list of components that support the given environment, and a boolean indicating if all components support the environment
Types ¶
type Environment ¶
type Environment string
Environment is a type that represents an environment name
const Development Environment = "development"
Development Development Environments
const IntegrationTest Environment = "integrationtest"
IntegrationTest - distributed testing, combining multiple repos & external services
const Local Environment = "local"
Local Local Development Environments
const Production Environment = "production"
Production live environment
const Sandbox Environment = "sandbox"
Sandbox public test environment
const UnitTest Environment = "unittest"
UnitTest Test Environments - same repo testing
func Parse ¶
func Parse(input string) (Environment, error)
Parse parses a string into an environment
func (Environment) AllowTestData ¶
func (e Environment) AllowTestData() bool
AllowTestData Check to allow for test data per environment
func (Environment) GetIdentifier ¶
func (e Environment) GetIdentifier() string
GetIdentifier returns the identifier for the environment, this is a single character for known environments, and 2 characters for unknown environments
func (Environment) IsDevOrTest ¶
func (e Environment) IsDevOrTest() bool
IsDevOrTest returns true if the environment is development, local, or a test case
func (Environment) IsDevelopment ¶
func (e Environment) IsDevelopment() bool
IsDevelopment returns true if the environment is development
func (Environment) IsIntegrationTest ¶
func (e Environment) IsIntegrationTest() bool
IsIntegrationTest returns true if the environment is an integration test
func (Environment) IsLocal ¶
func (e Environment) IsLocal() bool
IsLocal returns true if the environment is local
func (Environment) IsProduction ¶
func (e Environment) IsProduction() bool
IsProduction returns true if the environment is production
func (Environment) IsSandbox ¶
func (e Environment) IsSandbox() bool
IsSandbox returns true if the environment is a sandbox
func (Environment) IsTestCase ¶
func (e Environment) IsTestCase() bool
IsTestCase returns true if the environment is a test case either unit or integration
func (Environment) IsUnitTest ¶
func (e Environment) IsUnitTest() bool
IsUnitTest returns true if the environment is a unit test
type Name ¶
type Name string
Name is a type that represents an environment variable name
func (Name) Value ¶
Value returns the value of the environment variable, or an empty string if not set
func (Name) ValueInt ¶
ValueInt returns the value of the environment variable as an integer, or an error if not set
func (Name) ValueOrPanic ¶
ValueOrPanic returns the value of the environment variable, or panics if not set
func (Name) WithDefault ¶
WithDefault returns the value of the environment variable, or a default value if not set
type Supporter ¶
type Supporter interface {
SupportsEnvironment(environment Environment) bool
}
Supporter is an interface that can be implemented by any component to identify if it supports a given environment