fx

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppModule = func(cfg *config.Config) fx.Option {
	opts := []fx.Option{
		fx.Supply(cfg),
		ConfigModule,
		LoggerModule,
		IdentityModule,
		ServicesModule,
		ClientsModule,
		service.Module,
		handlers.Module,
		ServerModule,
	}
	if cfg.Deployment.InMemoryStores {
		opts = append(opts, memory.Module)
	} else {
		opts = append(opts, aws.Module)
	}
	return fx.Options(opts...)
}

AppModule aggregates all application modules.

ClientsModule provides external service clients.

View Source
var ConfigModule = fx.Module("config",
	fx.Provide(ProvideConfigs),
)
View Source
var IdentityModule = fx.Module("identity",
	fx.Provide(NewIdentity),
)

IdentityModule provides the service identity.

View Source
var LoggerModule = fx.Module("logger",
	fx.Provide(NewLogger),
)

LoggerModule provides the zap logger.

ServerModule provides the HTTP server with lifecycle management.

Functions

func NewEchoServer

func NewEchoServer(
	id *identity.Identity,
	svc *service.Service,
) *echo.Echo

NewEchoServer creates and configures the Echo HTTP server.

func NewIdentity

func NewIdentity(cfg *config.Config, logger *zap.Logger) (*identity.Identity, error)

NewIdentity creates an identity from the configured key file or generates one.

func NewLogger

func NewLogger(cfg *config.Config) (*zap.Logger, error)

NewLogger creates a zap logger based on the configured log level.

func NewMailingService added in v0.0.6

func NewMailingService(deploymentCfg config.DeploymentConfig, mailerCfg config.MailerConfig, logger *zap.Logger) (mailer.Mailer, error)

func NewPiriClientProvider added in v0.0.6

func NewPiriClientProvider(id *identity.Identity, logger *zap.Logger) piriclient.Provider

func NewProvisioningService added in v0.0.6

func NewProvisioningService(
	id *identity.Identity,
	consumerStore consumer.Store,
	subscriptionStore subscription.Store,
) *provisioning.Service

func RegisterServerLifecycle

func RegisterServerLifecycle(
	lc fx.Lifecycle,
	e *echo.Echo,
	cfg *config.Config,
	logger *zap.Logger,
	id *identity.Identity,
)

RegisterServerLifecycle hooks server start/stop to fx lifecycle.

Types

type Configs added in v0.0.6

type Configs struct {
	fx.Out
	Deployment config.DeploymentConfig
	Server     config.ServerConfig
	Identity   config.IdentityConfig
	Indexer    config.IndexerConfig
	DynamoDB   config.DynamoDBConfig
	S3         config.S3Config
	Log        config.LogConfig
	Mailer     config.MailerConfig
}

func ProvideConfigs added in v0.0.6

func ProvideConfigs(cfg *config.Config) Configs

ProvideConfigs provides the individual fields of the config.

type IndexerClientResult

type IndexerClientResult struct {
	fx.Out

	Client *indexerclient.Client `optional:"true"`
}

IndexerClientResult wraps the optional indexer client. Using fx.Out with optional tag allows this provider to return nil when the indexer is not configured.

func NewIndexerClient

func NewIndexerClient(
	cfg *config.Config,
	id *identity.Identity,
	logger *zap.Logger,
) IndexerClientResult

NewIndexerClient creates an indexer client if configured.

Directories

Path Synopsis
store
aws

Jump to

Keyboard shortcuts

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