Documentation
¶
Overview ¶
Package environment defines object describing the current environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateEnvironmentVariables ¶
func ValidateEnvironmentVariables(vars ...IEnvironmentVariable) error
ValidateEnvironmentVariables validates that environment variables are correctly defined in regard to their schema.
Types ¶
type EnvVar ¶
type EnvVar struct {
// contains filtered or unexported fields
}
func (*EnvVar) Equal ¶
func (e *EnvVar) Equal(v IEnvironmentVariable) bool
func (*EnvVar) MarshalText ¶
func (*EnvVar) UnmarshalText ¶
type IEnvironment ¶
type IEnvironment interface { // GetCurrentUser returns the environment current user. GetCurrentUser() *user.User // GetEnvironmentVariables returns the variables defining the environment. GetEnvironmentVariables() []IEnvironmentVariable // GetFilesystem returns the filesystem associated with the current environment GetFilesystem() filesystem.FS }
IEnvironment defines an environment for an application to run on.
func NewCurrentEnvironment ¶
func NewCurrentEnvironment() IEnvironment
NewCurrentEnvironment returns system current environment.
type IEnvironmentVariable ¶
type IEnvironmentVariable interface { encoding.TextMarshaler encoding.TextUnmarshaler fmt.Stringer // GetKey returns the variable key. GetKey() string // GetValue returns the variable value. GetValue() string // Validate checks whether the variable value is correctly defined Validate() error // Equal states whether two environment variables are equal or not. Equal(v IEnvironmentVariable) bool }
IEnvironmentVariable defines an environment variable to be set for the commands to run.
func NewEnvironmentVariable ¶
func NewEnvironmentVariable(key, value string) IEnvironmentVariable
NewEnvironmentVariable returns an environment variable defined by a key and a value.
func NewEnvironmentVariableWithValidation ¶
func NewEnvironmentVariableWithValidation(key, value string, rules ...validation.Rule) IEnvironmentVariable
NewEnvironmentVariableWithValidation returns an environment variable defined by a key and a value but with the possibility to define value validation rules.
func ParseEnvironmentVariable ¶
func ParseEnvironmentVariable(variable string) (IEnvironmentVariable, error)
ParseEnvironmentVariable parses an environment variable definition, in the form "key=value".