Documentation
¶
Index ¶
Constants ¶
const ApplicationName = "ledger"
Variables ¶
This section is empty.
Functions ¶
func WithSwaggerEnvConfig ¶
WithSwaggerEnvConfig returns a middleware that applies Swagger configuration from environment variables exactly once (on first request), ensuring thread-safe initialization without data races on the global api.SwaggerInfo.
Types ¶
type Config ¶
type Config struct {
EnvName string `env:"ENV_NAME"`
LogLevel string `env:"LOG_LEVEL"`
Version string `env:"VERSION"`
// Server configuration - unified port for all APIs
ServerAddress string `env:"SERVER_ADDRESS" envDefault:":3002"`
// OpenTelemetry configuration
OtelServiceName string `env:"OTEL_RESOURCE_SERVICE_NAME"`
OtelLibraryName string `env:"OTEL_LIBRARY_NAME"`
OtelServiceVersion string `env:"OTEL_RESOURCE_SERVICE_VERSION"`
OtelDeploymentEnv string `env:"OTEL_RESOURCE_DEPLOYMENT_ENVIRONMENT"`
OtelColExporterEndpoint string `env:"OTEL_EXPORTER_OTLP_ENDPOINT"`
EnableTelemetry bool `env:"ENABLE_TELEMETRY"`
// Auth configuration
AuthEnabled bool `env:"PLUGIN_AUTH_ENABLED"`
AuthHost string `env:"PLUGIN_AUTH_HOST"`
}
Config is the top level configuration struct for the unified ledger component.
type Options ¶
type Options struct {
// Logger allows callers to provide a pre-configured logger, avoiding multiple
// initializations when composing components (e.g. unified ledger).
Logger libLog.Logger
}
Options contains optional dependencies that can be injected by callers.
type RouteRegistrar ¶
RouteRegistrar is a function that registers routes to an existing Fiber app. Each module (onboarding, transaction) implements this to register its routes.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server for Ledger metadata index services.
func NewServer ¶
func NewServer(cfg *Config, app *fiber.App, logger libLog.Logger, telemetry *libOpentelemetry.Telemetry) *Server
NewServer creates an instance of Server.
func (*Server) ServerAddress ¶
ServerAddress returns the server address.
type Service ¶
type Service struct {
OnboardingService onboarding.OnboardingService
TransactionService transaction.TransactionService
UnifiedServer *UnifiedServer
Logger libLog.Logger
Telemetry *libOpentelemetry.Telemetry
}
Service is the unified ledger service that composes onboarding and transaction.
func InitServers ¶
InitServers initializes the unified ledger service that composes both onboarding and transaction modules in a single process. The transaction module is initialized first so its BalancePort (the UseCase) can be passed directly to onboarding for in-process calls.
func InitServersWithOptions ¶
InitServersWithOptions initializes the unified ledger service with optional dependency injection.
func (*Service) GetRunnables ¶
func (s *Service) GetRunnables() []mbootstrap.RunnableConfig
GetRunnables returns all runnable components for the unified ledger. This can be used for custom launcher configuration if needed.
type UnifiedServer ¶
type UnifiedServer struct {
// contains filtered or unexported fields
}
UnifiedServer consolidates all HTTP APIs (onboarding + transaction) in a single Fiber server. This enables the unified ledger mode where all routes are accessible on a single port.
func NewUnifiedServer ¶
func NewUnifiedServer( serverAddress string, logger libLog.Logger, telemetry *libOpentelemetry.Telemetry, routeRegistrars ...RouteRegistrar, ) *UnifiedServer
NewUnifiedServer creates a server that exposes all APIs on a single port. It accepts route registration functions from each module to compose all routes in one Fiber app.
func (*UnifiedServer) Run ¶
func (s *UnifiedServer) Run(l *libCommons.Launcher) error
Run implements mbootstrap.Runnable interface. Starts the unified HTTP server with graceful shutdown support.
func (*UnifiedServer) ServerAddress ¶
func (s *UnifiedServer) ServerAddress() string
ServerAddress returns the server address for logging/debugging purposes.