Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Prod = fx.Module(moduleName, fx.Decorate(func(l *zap.Logger) *zap.Logger { return l.Named(moduleName) }), fx.Provide(fx.Annotate( func(o env.Options) (c Config, err error) { o.Prefix = strings.ToUpper(moduleName) + "_" return c, env.Parse(&c, o) }, fx.ParamTags(`optional:"true"`))), fx.Provide(fx.Annotate(New, fx.ParamTags(``, ``, ``, `optional:"true"`, `optional:"true"`))), fx.Provide(fx.Annotate(func(cfg Config) aws.EndpointResolverWithOptions { return aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (ep aws.Endpoint, err error) { switch { case service == dynamodb.ServiceID && cfg.DynamoEndpoint != nil: ep.URL = cfg.DynamoEndpoint.String() return ep, err default: return ep, &aws.EndpointNotFoundError{} } }) })), )
Prod configures the DI for providng database connectivity
Functions ¶
func New ¶
func New( cfg Config, logs *zap.Logger, epresolver aws.EndpointResolverWithOptions, tp trace.TracerProvider, pr propagation.TextMapPropagator, ) (acfg aws.Config, err error)
New initialize an AWS config to be used to create clients for individual aws services. We would like run this during fx lifecycle phase to provide it with a context because it can block. But too many dependencies would have to wait for it.
Types ¶
type Config ¶
type Config struct { // LoadConfigTimeout bounds the time given to config loading LoadConfigTimeout time.Duration `env:"LOAD_CONFIG_TIMEOUT" envDefault:"100ms"` // DynamoEndpoint allows configuring the dynamodb endpoint for testing because it supports a local version DynamoEndpoint *url.URL `env:"DYNAMO_ENDPOINT"` }
Config configures this package
Click to show internal directories.
Click to hide internal directories.