env

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAccessKeyID     = "gosoline"
	DefaultSecretAccessKey = "gosoline"
	DefaultToken           = ""
)
View Source
const (
	ComponentLocalstack = "localstack"
)

Variables

This section is empty.

Functions

func GetDefaultAwsSdkConfig

func GetDefaultAwsSdkConfig() (aws.Config, error)

func GetDefaultStaticCredentials

func GetDefaultStaticCredentials() credentials.StaticCredentialsProvider

func NewContainerRunner

func NewContainerRunner(config cfg.Config, logger log.Logger) (*containerRunner, error)

func UnmarshalSettings added in v0.15.4

func UnmarshalSettings(config cfg.Config, settings interface{}, typ string, name string)

Types

type AutoDetectSettings

type AutoDetectSettings struct {
	Enabled        bool     `cfg:"enabled" default:"true"`
	SkipComponents []string `cfg:"skip_components"`
}

type ChannelRecords added in v0.26.1

type ChannelRecords []LogRecord

func (ChannelRecords) Filter added in v0.26.1

func (logs ChannelRecords) Filter(condition func(LogRecord) bool) ChannelRecords

type Component

type Component interface {
	SetT(t *testing.T)
}

type ComponentAddressAware

type ComponentAddressAware interface {
	Address() string
}

type ComponentBaseSettings

type ComponentBaseSettings struct {
	Name string `cfg:"name" default:"default"`
	Type string `cfg:"type" validate:"required"`
}

func (*ComponentBaseSettings) GetName

func (c *ComponentBaseSettings) GetName() string

func (*ComponentBaseSettings) GetType

func (c *ComponentBaseSettings) GetType() string

func (*ComponentBaseSettings) SetName

func (c *ComponentBaseSettings) SetName(name string)

func (*ComponentBaseSettings) SetType

func (c *ComponentBaseSettings) SetType(typ string)

type ComponentBaseSettingsAware

type ComponentBaseSettingsAware interface {
	GetName() string
	GetType() string
	SetName(name string)
	SetType(typ string)
}

type ComponentCfgOptionAware

type ComponentCfgOptionAware interface {
	CfgOptions() []cfg.Option
}

type ComponentContainerSettings

type ComponentContainerSettings struct {
	Image       ContainerImageSettings `cfg:"image"`
	ExpireAfter time.Duration          `cfg:"expire_after" default:"60s"`
	Tmpfs       []TmpfsSettings        `cfg:"tmpfs"`
}

type ComponentHealthCheck

type ComponentHealthCheck func(container *container) error

type ComponentOption

type ComponentOption func(componentConfigManger *ComponentsConfigManager) error

type ComponentShutdownCallback

type ComponentShutdownCallback func(container *container) func() error

type ComponentsConfigManager

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

func NewComponentsConfigManager

func NewComponentsConfigManager(config cfg.GosoConf) *ComponentsConfigManager

func (*ComponentsConfigManager) Add

func (m *ComponentsConfigManager) Add(settings interface{}) error

func (*ComponentsConfigManager) GetAllSettings

func (m *ComponentsConfigManager) GetAllSettings() ([]ComponentBaseSettingsAware, error)

func (*ComponentsConfigManager) Has

func (m *ComponentsConfigManager) Has(typ string, name string) bool

func (*ComponentsConfigManager) HasType

func (m *ComponentsConfigManager) HasType(typ string) bool

func (*ComponentsConfigManager) List

func (m *ComponentsConfigManager) List() map[string]map[string]interface{}

func (*ComponentsConfigManager) ShouldAutoDetect

func (m *ComponentsConfigManager) ShouldAutoDetect(typ string) bool

type ComponentsContainer

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

func NewComponentsContainer

func NewComponentsContainer() *ComponentsContainer

func (*ComponentsContainer) Add

func (c *ComponentsContainer) Add(typ string, name string, component Component)

func (*ComponentsContainer) Get

func (c *ComponentsContainer) Get(componentType string, name string) (Component, error)

func (*ComponentsContainer) GetAll

func (c *ComponentsContainer) GetAll() []Component

func (*ComponentsContainer) GetCfgOptions

func (c *ComponentsContainer) GetCfgOptions() []cfg.Option

type ConfigOption

type ConfigOption func(config cfg.GosoConf) error

type ContainerBindingSettings

type ContainerBindingSettings struct {
	Host string `cfg:"host" default:"127.0.0.1"`
	Port int    `cfg:"port" default:"0"`
}

type ContainerImageSettings added in v0.15.4

type ContainerImageSettings struct {
	Repository string `cfg:"repository"`
	Tag        string `cfg:"tag"`
}

type DdbComponent

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

func (*DdbComponent) Address

func (c *DdbComponent) Address() string

func (*DdbComponent) CfgOptions

func (c *DdbComponent) CfgOptions() []cfg.Option

func (*DdbComponent) Client

func (c *DdbComponent) Client() *dynamodb.Client

func (*DdbComponent) Endpoint

func (c *DdbComponent) Endpoint() string

func (*DdbComponent) Repository

func (c *DdbComponent) Repository(settings *ddb.Settings) (ddb.Repository, error)

func (*DdbComponent) SetT

func (c *DdbComponent) SetT(t *testing.T)

func (*DdbComponent) Toxiproxy

func (c *DdbComponent) Toxiproxy() *toxiproxy.Proxy

type Environment

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

func NewEnvironment

func NewEnvironment(t *testing.T, options ...Option) (*Environment, error)

func (*Environment) Clock

func (e *Environment) Clock() clock.Clock

func (*Environment) Component

func (e *Environment) Component(typ string, name string) Component

func (*Environment) Config

func (e *Environment) Config() cfg.GosoConf

func (*Environment) Context

func (e *Environment) Context() context.Context

func (*Environment) DynamoDb

func (e *Environment) DynamoDb(name string) *DdbComponent

func (*Environment) Filesystem

func (e *Environment) Filesystem() *filesystem

func (*Environment) LoadFixtureSets added in v0.24.0

func (e *Environment) LoadFixtureSets(factories ...fixtures.FixtureSetsFactory) error

func (*Environment) Localstack

func (e *Environment) Localstack(name string) *localstackComponent

func (*Environment) Logger

func (e *Environment) Logger() log.GosoLogger

func (*Environment) Logs added in v0.18.1

func (e *Environment) Logs() LogRecords

func (*Environment) MySql

func (e *Environment) MySql(name string) *mysqlComponent

func (*Environment) Redis

func (e *Environment) Redis(name string) *RedisComponent

func (*Environment) ResetLogs added in v0.21.4

func (e *Environment) ResetLogs()

func (*Environment) S3

func (e *Environment) S3(name string) *S3Component

func (*Environment) Stop

func (e *Environment) Stop() error

func (*Environment) StreamInput

func (e *Environment) StreamInput(name string) *StreamInputComponent

func (*Environment) StreamOutput

func (e *Environment) StreamOutput(name string) *streamOutputComponent

func (*Environment) Wiremock

func (e *Environment) Wiremock(name string) *wiremockComponent

type LogRecord added in v0.18.1

type LogRecord struct {
	Timestamp    time.Time
	Level        int
	Msg          string
	Args         []any
	Err          error
	Data         log.Data
	FormattedMsg string
}

type LogRecords added in v0.18.1

type LogRecords map[string]ChannelRecords

func (LogRecords) Channel added in v0.26.1

func (logs LogRecords) Channel(channel string) ChannelRecords

func (LogRecords) Filter added in v0.18.1

func (logs LogRecords) Filter(condition func(LogRecord) bool) LogRecords

type LoggerOption

type LoggerOption func(settings *LoggerSettings) error

type LoggerSettings

type LoggerSettings struct {
	Level      string
	RecordLogs bool
}

type Option

type Option func(env *Environment)

func WithComponent

func WithComponent(settings ComponentBaseSettingsAware) Option

func WithConfigEnvKeyReplacer

func WithConfigEnvKeyReplacer(replacer *strings.Replacer) Option

func WithConfigFile

func WithConfigFile(file string) Option

func WithConfigMap

func WithConfigMap(settings map[string]interface{}) Option

func WithConfigSetting

func WithConfigSetting(key string, settings interface{}) Option

func WithContainerExpireAfter

func WithContainerExpireAfter(expireAfter time.Duration) Option

func WithLogRecording added in v0.18.1

func WithLogRecording() Option

func WithLoggerLevel

func WithLoggerLevel(level string) Option

func WithoutAutoDetectedComponents

func WithoutAutoDetectedComponents(components ...string) Option

type RecordingLogger added in v0.18.1

type RecordingLogger interface {
	log.GosoLogger
	Records() LogRecords
	Reset()
}

func NewRecordingConsoleLogger added in v0.18.1

func NewRecordingConsoleLogger(options ...LoggerOption) (RecordingLogger, error)

type RedisComponent

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

func (*RedisComponent) Address

func (c *RedisComponent) Address() string

func (*RedisComponent) CfgOptions

func (c *RedisComponent) CfgOptions() []cfg.Option

func (*RedisComponent) Client

func (c *RedisComponent) Client() *redis.Client

func (*RedisComponent) SetT

func (c *RedisComponent) SetT(t *testing.T)

type S3Component

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

func (*S3Component) CfgOptions

func (c *S3Component) CfgOptions() []cfg.Option

func (*S3Component) Client

func (c *S3Component) Client() *s3.Client

func (*S3Component) SetT

func (c *S3Component) SetT(t *testing.T)

type StreamInputComponent

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

func (*StreamInputComponent) CfgOptions

func (s *StreamInputComponent) CfgOptions() []cfg.Option

func (*StreamInputComponent) Publish

func (s *StreamInputComponent) Publish(body interface{}, attributes map[string]string)

func (*StreamInputComponent) PublishAndStop

func (s *StreamInputComponent) PublishAndStop(body interface{}, attributes map[string]string)

func (*StreamInputComponent) PublishFromJsonFile

func (s *StreamInputComponent) PublishFromJsonFile(fileName string)

func (*StreamInputComponent) SetT

func (c *StreamInputComponent) SetT(t *testing.T)

func (*StreamInputComponent) Stop

func (s *StreamInputComponent) Stop()

type TmpfsSettings

type TmpfsSettings struct {
	Path string `cfg:"path"`
	Size string `cfg:"size"`
	Mode string `cfg:"mode"`
}

Jump to

Keyboard shortcuts

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