environment

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Code generated by MockGen. DO NOT EDIT. Source: addget.go

Generated by this command:

mockgen -source=addget.go -package environment -destination addget_mock.gen.go

Package environment is a generated GoMock package.

Code generated by MockGen. DO NOT EDIT. Source: s3.go

Generated by this command:

mockgen -source=s3.go -package environment -destination s3_mock.gen.go

Package environment is a generated GoMock package.

Code generated by MockGen. DO NOT EDIT. Source: ssm.go

Generated by this command:

mockgen -source=ssm.go -package environment -destination ssmclient_mock.gen.go

Package environment is a generated GoMock package.

Index

Constants

View Source
const (
	AWSRegionEnvVar = "AWS_REGION"
	// NoS3EnvVar is the environment variable to set when you do not want to try and pull from S3.
	NoS3EnvVar = "NO_S3_ENV_VARS"
	// NoSSMEnvVar is the environment variable to set when you do not want to try and pull from SSM.
	NoSSMEnvVar = "NO_SSM_ENV_VARS"
	// S3GlobalEnvironmentBucketVar is an environment variable for the global environment in S3.
	S3GlobalEnvironmentBucketVar = "S3_GLOBAL_ENV_BUCKET"
	// GlobalEnvironmentVar is the environment variable to set the environment for S3 and SSM.
	GlobalEnvironmentVar = "GLOBAL_ENVIRONMENT"
	// GlobalProjectVar is the environment variable to set the project for S3 and SSM.
	GlobalProjectVar = "GLOBAL_PROJECT"
)

Variables

This section is empty.

Functions

func Get

func Get(key string, defaultVal string) string

Get returns the value of an environment variable if the variable is set, else the default value

func GetEnvMap

func GetEnvMap() map[string]string

GetEnvMap returns a map of all environment variables to their values

func NewInvalidSpecificationError

func NewInvalidSpecificationError() errors.TracerError

NewInvalidSpecificationError instantiates a InvalidSpecificationError with a stack trace

func NewMissingEnvironmentVariableError

func NewMissingEnvironmentVariableError(field string, tag string) errors.TracerError

NewMissingEnvironmentVariableError instantiates a MissingEnvironmentVariableError with a stack trace

func NewUnsupportedDataTypeError

func NewUnsupportedDataTypeError(dataType reflect.Kind, field string) errors.TracerError

NewUnsupportedDataTypeError instantiates a UnsupportedDataTypeError with a stack trace

func Process

func Process(config interface{}, logger log.Logger) error

Process takes a Specification that describes the configuration for the application only attributes tagged with `env:""` will be imported from the environment Example Specification:

type Specification struct {
    DatabaseURL string `env:"DATABASE_URL"`
    ServiceID   string `env:"SERVICE_ID,optional"`
}

Supported options: optional

func ProcessMap

func ProcessMap(config interface{}, envVars map[string]string, logger log.Logger) error

ProcessMap is the same as Process except that the environment variable map is supplied instead of retrieved

func Push

func Push(config interface{}) error

Push the passed specification object onto the environment, note that these changes will not live past the life of this process.

func RedisAddress

func RedisAddress() string

RedisAddress returns the combined host and port from the environment

func RedisHost

func RedisHost() string

RedisHost returns the host value from the environment

func RedisPort

func RedisPort() int

RedisPort returns the port value from the environment

Types

type AddGet added in v2.22.0

type AddGet interface {
	// Add adds the passed data to this AddGet
	Add(project string, data map[string]interface{})
	// Get data by project and key for this AddGet
	Get(project, key string) (interface{}, bool)
}

AddGet inteface for representing a data store that can add and get

func NewBucket

func NewBucket(ctx context.Context, region, bucketName, environment,
	project string, logger log.Logger) AddGet

NewBucket returns a Bucket with an S3 downloader and an initialized cache

func NewNoopAddGet added in v2.22.0

func NewNoopAddGet() AddGet

func NewSSM added in v2.20.0

func NewSSM(ctx context.Context, region, environment, project string,
	logger log.Logger) AddGet

NewSSM returns a SSM for the environment with a client and an initialized cache

type InvalidSpecificationError

type InvalidSpecificationError struct {
	// contains filtered or unexported fields
}

InvalidSpecificationError indicates that a config is of the wrong type.

func (*InvalidSpecificationError) Error

func (err *InvalidSpecificationError) Error() string

func (*InvalidSpecificationError) Trace

func (err *InvalidSpecificationError) Trace() []string

Trace returns the stack trace for the error

type MissingEnvironmentVariableError

type MissingEnvironmentVariableError struct {
	Field string
	Tag   string
	// contains filtered or unexported fields
}

MissingEnvironmentVariableError indicates that a non-optional variable was not found in the environment

func (MissingEnvironmentVariableError) Error

func (*MissingEnvironmentVariableError) Trace

func (err *MissingEnvironmentVariableError) Trace() []string

Trace returns the stack trace for the error

type MockAddGet added in v2.22.0

type MockAddGet struct {
	// contains filtered or unexported fields
}

MockAddGet is a mock of AddGet interface.

func NewMockAddGet added in v2.22.0

func NewMockAddGet(ctrl *gomock.Controller) *MockAddGet

NewMockAddGet creates a new mock instance.

func (*MockAddGet) Add added in v2.22.0

func (m *MockAddGet) Add(project string, data map[string]any)

Add mocks base method.

func (*MockAddGet) EXPECT added in v2.22.0

func (m *MockAddGet) EXPECT() *MockAddGetMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAddGet) Get added in v2.22.0

func (m *MockAddGet) Get(project, key string) (any, bool)

Get mocks base method.

type MockAddGetMockRecorder added in v2.22.0

type MockAddGetMockRecorder struct {
	// contains filtered or unexported fields
}

MockAddGetMockRecorder is the mock recorder for MockAddGet.

func (*MockAddGetMockRecorder) Add added in v2.22.0

func (mr *MockAddGetMockRecorder) Add(project, data any) *gomock.Call

Add indicates an expected call of Add.

func (*MockAddGetMockRecorder) Get added in v2.22.0

func (mr *MockAddGetMockRecorder) Get(project, key any) *gomock.Call

Get indicates an expected call of Get.

type Mocks3Client added in v2.22.0

type Mocks3Client struct {
	// contains filtered or unexported fields
}

Mocks3Client is a mock of s3Client interface.

func NewMocks3Client added in v2.22.0

func NewMocks3Client(ctrl *gomock.Controller) *Mocks3Client

NewMocks3Client creates a new mock instance.

func (*Mocks3Client) Download added in v2.22.0

func (m *Mocks3Client) Download(ctx context.Context, w io.WriterAt, input *s3.GetObjectInput, options ...func(*manager.Downloader)) (int64, error)

Download mocks base method.

func (*Mocks3Client) EXPECT added in v2.22.0

EXPECT returns an object that allows the caller to indicate expected use.

type Mocks3ClientMockRecorder added in v2.22.0

type Mocks3ClientMockRecorder struct {
	// contains filtered or unexported fields
}

Mocks3ClientMockRecorder is the mock recorder for Mocks3Client.

func (*Mocks3ClientMockRecorder) Download added in v2.22.0

func (mr *Mocks3ClientMockRecorder) Download(ctx, w, input any, options ...any) *gomock.Call

Download indicates an expected call of Download.

type MockssmClient added in v2.20.0

type MockssmClient struct {
	// contains filtered or unexported fields
}

MockssmClient is a mock of ssmClient interface.

func NewMockssmClient added in v2.20.0

func NewMockssmClient(ctrl *gomock.Controller) *MockssmClient

NewMockssmClient creates a new mock instance.

func (*MockssmClient) EXPECT added in v2.20.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockssmClient) GetParametersByPath added in v2.20.0

func (m *MockssmClient) GetParametersByPath(arg0 context.Context, arg1 *ssm.GetParametersByPathInput, arg2 ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error)

GetParametersByPath mocks base method.

type MockssmClientMockRecorder added in v2.20.0

type MockssmClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockssmClientMockRecorder is the mock recorder for MockssmClient.

func (*MockssmClientMockRecorder) GetParametersByPath added in v2.20.0

func (mr *MockssmClientMockRecorder) GetParametersByPath(arg0, arg1 any, arg2 ...any) *gomock.Call

GetParametersByPath indicates an expected call of GetParametersByPath.

type UnsupportedDataTypeError

type UnsupportedDataTypeError struct {
	Type  reflect.Kind
	Field string
	// contains filtered or unexported fields
}

UnsupportedDataTypeError indicates that no conversion from string to the given type has been implemented

func (UnsupportedDataTypeError) Error

func (err UnsupportedDataTypeError) Error() string

func (*UnsupportedDataTypeError) Trace

func (err *UnsupportedDataTypeError) Trace() []string

Trace returns the stack trace for the error

Jump to

Keyboard shortcuts

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