Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway handles proxying requests to backend services.
func NewGateway ¶
func NewGateway(registry *ServiceRegistry, log *logger.Logger) *Gateway
NewGateway creates a new API gateway.
func (*Gateway) ProxyRequest ¶
func (g *Gateway) ProxyRequest(w http.ResponseWriter, r *http.Request)
ProxyRequest proxies the request to the appropriate backend service.
type ServiceInfo ¶
type ServiceInfo struct {
URL string
IsAlias bool // If true, don't strip the service name from path
}
ServiceInfo contains URL and routing configuration for a service.
type ServiceRegistry ¶
type ServiceRegistry struct {
Identity string
Ledger string
RBAC string
Transaction string
Wallet string
Risk string
Simulation string
}
ServiceRegistry holds the URLs of all backend services.
func NewServiceRegistry ¶
func NewServiceRegistry() *ServiceRegistry
NewServiceRegistry creates a new service registry from environment variables.
func (*ServiceRegistry) AllServices ¶
func (r *ServiceRegistry) AllServices() map[string]string
AllServices returns a map of all registered services.
func (*ServiceRegistry) GetServiceByPath ¶
func (r *ServiceRegistry) GetServiceByPath(path string) *ServiceInfo
GetServiceByPath checks if the path matches any special routing rules. Returns service info if a rule matches, or nil if default routing should be used.
func (*ServiceRegistry) GetServiceInfo ¶
func (r *ServiceRegistry) GetServiceInfo(serviceName string) (*ServiceInfo, error)
GetServiceInfo returns the service configuration for a given service name.
func (*ServiceRegistry) GetServiceURL ¶
func (r *ServiceRegistry) GetServiceURL(serviceName string) (string, error)
GetServiceURL returns the URL for a given service name (for backward compatibility).