Documentation
¶
Index ¶
- Variables
- func AppModule(cfg *config.Config) fx.Option
- func NewEchoServer(p ServerParams) *echo.Echo
- func NewIdentity(cfg config.IdentityConfig, logger *zap.Logger) (identity.Identity, error)
- func NewLogger(cfg config.LogConfig) (*zap.Logger, error)
- func NewPLCClient(cfg config.PLCConfig) (*plc.DirectoryClient, error)
- func NewUCANServer(p UCANServerParams) (*server.HTTPServer, error)
- func NewUploadClient(id identity.Identity, cfg config.UploadConfig, logger *zap.Logger) (*client.UploadClient, error)
- func RegisterServerLifecycle(lc fx.Lifecycle, e *echo.Echo, cfg config.ServerConfig, logger *zap.Logger)
- type Configs
- type ServerParams
- type UCANServerParams
Constants ¶
This section is empty.
Variables ¶
var APIModule = fx.Module("api", fx.Provide( tenantsvc.New, accesskeysvc.New, asRoute(api.NewProvisionTenantHandler), asRoute(api.NewGetTenantHandler), asRoute(api.NewDeleteTenantHandler), asRoute(api.NewUpdateTenantStatusHandler), asRoute(api.NewCreateAccessKeyHandler), asRoute(api.NewListAccessKeysHandler), asRoute(api.NewGetAccessKeyHandler), asRoute(api.NewDeleteAccessKeyHandler), ), )
APIModule provides the tenant management API services + handlers as routes, collected into the "routes" group and registered on the echo server.
var ConfigModule = fx.Module("config", fx.Provide(ProvideConfigs), )
ConfigModule surfaces the individual config sections so consumers can depend on just the part they need.
var IdentityModule = fx.Module("identity", fx.Provide(NewIdentity), )
IdentityModule provides the Hilt service identity used by the UCAN RPC server.
LoggerModule provides the zap logger.
var PLCModule = fx.Module("plc", fx.Provide(NewPLCClient), )
PLCModule provides a did:plc directory client for the tenant handlers.
var RPCModule = fx.Module("rpc", fx.Provide( auth.NewAuthorizer, fx.Annotate( NewUploadClient, fx.As(fx.Self()), fx.As(new(bucketsvc.UploadClient)), ), bucketsvc.New, NewUCANServer, asUCANRoute(rpc.NewAuthorizeRequestHandler), asUCANRoute(rpc.NewCreateBucketHandler), asUCANRoute(rpc.NewDeleteBucketHandler), asUCANRoute(rpc.NewBucketInfoHandler), asUCANRoute(rpc.NewListBucketsHandler), asUCANRoute(rpc.NewAddProviderHandler), ), )
RPCModule provides the Hilt UCAN RPC server and the command handlers it serves, collected into the "ucanRoutes" group.
var ServerModule = fx.Module("server", fx.Provide(NewEchoServer), fx.Invoke(RegisterServerLifecycle), )
ServerModule provides the HTTP server with lifecycle management.
Functions ¶
func AppModule ¶
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 ¶
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 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 ¶
type Configs struct {
fx.Out
Identity config.IdentityConfig
Server config.ServerConfig
Log config.LogConfig
Storage config.StorageConfig
Postgres config.PostgresConfig
Vault config.VaultConfig
Hashicorp config.HashicorpConfig
PLC config.PLCConfig
Auth config.AuthConfig
Upload config.UploadConfig
}
Configs exposes the individual fields of the config to the fx graph.
func ProvideConfigs ¶
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).
Source Files
¶
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. |