fx

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0, MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

APIModule provides the tenant management API services + handlers as routes, collected into the "routes" group and registered on the echo server.

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

ConfigModule surfaces the individual config sections so consumers can depend on just the part they need.

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

IdentityModule provides the Hilt service identity used by the UCAN RPC server.

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

LoggerModule provides the zap logger.

View Source
var PLCModule = fx.Module("plc",
	fx.Provide(NewPLCClient),
)

PLCModule provides a did:plc directory client for the tenant handlers.

RPCModule provides the Hilt UCAN RPC server and the command handlers it serves, collected into the "ucanRoutes" group.

ServerModule provides the HTTP server with lifecycle management.

Functions

func AppModule

func AppModule(cfg *config.Config) fx.Option

AppModule aggregates all application modules into a single fx option, selecting the storage backend from the configured storage type.

func NewEchoServer

func NewEchoServer(p ServerParams) *echo.Echo

NewEchoServer creates and configures the Echo HTTP server.

func NewIdentity

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

NewIdentity builds the service identity from configuration. With a key file it loads the PEM-encoded Ed25519 key (wrapping it with the configured did:web when set); otherwise it generates an ephemeral identity (whose DID changes each restart).

func NewLogger

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

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

func NewPLCClient

func NewPLCClient(cfg config.PLCConfig) (*plc.DirectoryClient, error)

NewPLCClient builds a did:plc directory client from configuration.

func NewUCANServer

func NewUCANServer(p UCANServerParams) (*server.HTTPServer, error)

NewUCANServer builds the ucantone UCAN RPC server with the service identity and registers each command handler. The returned *server.HTTPServer is an http.Handler mounted on the echo server (see NewEchoServer).

The server is configured with a DID resolver that supports did:key and did:web. did:web is required so the validator can verify UCANs issued by, or addressed to, did:web identities — including Hilt's own service identity when identity.service_id is a did:web. The service's own DID document is resolved locally (no network round-trip) via a well-known tier ahead of the cached HTTP resolver.

func NewUploadClient

func NewUploadClient(id identity.Identity, cfg config.UploadConfig, logger *zap.Logger) (*client.UploadClient, error)

NewUploadClient builds the Sprue upload-service client from configuration. Its proof store — the delegations it presents to Sprue — is loaded from upload.proofs (see [uploadProofs]).

func RegisterServerLifecycle

func RegisterServerLifecycle(
	lc fx.Lifecycle,
	e *echo.Echo,
	cfg config.ServerConfig,
	logger *zap.Logger,
)

RegisterServerLifecycle hooks server start/stop to the fx lifecycle.

Types

type Configs

Configs exposes the individual fields of the config to the fx graph.

func ProvideConfigs

func ProvideConfigs(cfg *config.Config) Configs

ProvideConfigs provides the individual fields of the config.

type ServerParams

type ServerParams struct {
	fx.In
	Logger     *zap.Logger
	Auth       config.AuthConfig
	Identity   identity.Identity
	Routes     []api.Route `group:"routes"`
	UCANServer *server.HTTPServer
}

ServerParams are the dependencies for constructing the echo server. Routes are collected from the "routes" fx group (see APIModule).

type UCANServerParams

type UCANServerParams struct {
	fx.In
	Identity identity.Identity   // embeds multikey.Issuer, satisfying ucan.Issuer
	Server   config.ServerConfig // supplies InsecureDIDResolution
	Logger   *zap.Logger
	Routes   []server.Route `group:"ucanRoutes"`
}

UCANServerParams are the dependencies for the UCAN RPC server. Handlers are collected from the "ucanRoutes" fx group (see RPCModule).

Directories

Path Synopsis
store
memory
Package memory wires the in-memory store implementations into the application via uber-go/fx.
Package memory wires the in-memory store implementations into the application via uber-go/fx.
postgres
Package postgres wires the Postgres-backed store implementations into the application via uber-go/fx.
Package postgres wires the Postgres-backed store implementations into the application via uber-go/fx.
vault
hashicorp
Package hashicorp wires the HashiCorp Vault-backed vault implementation into the application via uber-go/fx.
Package hashicorp wires the HashiCorp Vault-backed vault implementation into the application via uber-go/fx.
memory
Package memory wires the in-memory vault implementation into the application via uber-go/fx.
Package memory wires the in-memory vault implementation into the application via uber-go/fx.

Jump to

Keyboard shortcuts

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