Documentation
¶
Index ¶
- func New[PUBRO, PUBRW, PRIVRW, PRIVRWC any](deps struct{ ... }) (res struct{ ... }, err error)
- func Provide[PUBRO, PUBRW, PRIVRW, PRIVRWC any](rpcBasePath string, withOpenAPI bool, ...) fx.Option
- func ProvideLambdaRelay[C, E any](slug string, handler LambdaRelayHandler[C, E]) fx.Option
- func TestProvide[PUBRO, PUBRW, PRIVRW, PUBROC, PUBRWC, PRIVRWC any](rpcBasePath string, withOpenAPI bool, ...) fx.Option
- type Config
- type HealthCheck
- type LambdaRelay
- type LambdaRelayHandler
- type RPCBasePath
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New[PUBRO, PUBRW, PRIVRW, PRIVRWC any](deps struct { fx.In fx.Lifecycle Config Config BasePath RPCBasePath Logger *zap.Logger Validator protovalidate.Validator AuthMiddleware *authn.Middleware HealthCheck HealthCheck PublicReadOnly PUBRO PublicReadWrite PUBRW PrivateReadWrite PRIVRW NewPublicReadOnly func(svc PUBRO, opts ...connect.HandlerOption) (string, http.Handler) NewPublicReadWrite func(svc PUBRW, opts ...connect.HandlerOption) (string, http.Handler) NewPrivateReadWrite func(svc PRIVRW, opts ...connect.HandlerOption) (string, http.Handler) // dependencies for building lambda relays. NewPrivateReadWriteClient func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PRIVRWC LambdaRelays []*LambdaRelay `group:"lambda_relays"` // optionally server a public. PublicOpenAPIMount *openAPIMount `optional:"true"` }) (res struct { fx.Out Public http.Handler `name:"public"` Private http.Handler `name:"private"` }, err error, )
func Provide ¶
func Provide[PUBRO, PUBRW, PRIVRW, PRIVRWC any]( rpcBasePath string, withOpenAPI bool, newPubROFunc func(svc PUBRO, opts ...connect.HandlerOption) (string, http.Handler), newPubRWFunc func(svc PUBRW, opts ...connect.HandlerOption) (string, http.Handler), newprivRWFunc func(svc PRIVRW, opts ...connect.HandlerOption) (string, http.Handler), newPrivRWCFunc func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PRIVRWC, ) fx.Option
Provide the components as fx dependencies.
func ProvideLambdaRelay ¶
func ProvideLambdaRelay[C, E any]( slug string, handler LambdaRelayHandler[C, E], ) fx.Option
ProvideLambdaRelay can be used to init a lambda relay while adding it to the right fx group.
func TestProvide ¶
func TestProvide[PUBRO, PUBRW, PRIVRW, PUBROC, PUBRWC, PRIVRWC any]( rpcBasePath string, withOpenAPI bool, newPubROFunc func(svc PUBRO, opts ...connect.HandlerOption) (string, http.Handler), newPubRWFunc func(svc PUBRW, opts ...connect.HandlerOption) (string, http.Handler), newprivRWFunc func(svc PRIVRW, opts ...connect.HandlerOption) (string, http.Handler), newPubROCFunc func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PUBROC, newPubRWCFunc func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PUBRWC, newPrivRWCFunc func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PRIVRWC, clientOpts ...connect.ClientOption, ) fx.Option
TestProvide provides API clients for testing. We use the actual web public and private HTTP handler to get as much parity as possible.
Types ¶
type Config ¶
type Config struct {
// allow health endpoint to panic, for testing purposes.
AllowForcedPanics bool `env:"ALLOW_FORCED_PANICS"`
// response validation can be enabled in testing to catch errors early.
ResponseValidation bool `env:"RESPONSE_VALIDATION"`
// cache the pre-flight response more readily, it is not dynamic.
ConnectCORSMaxAgeSeconds int `env:"CONNECT_CORS_MAX_AGE_SECONDS" envDefault:"3600"`
// allow configuration of CORS allowed origins
ConnectCORSAllowedOrigins []string `env:"CONNECT_CORS_ALLOWED_ORIGINS"`
// for making the hosted openapi spec fully descriptive, the environmnet must specify how to reach it externally.
OpenAPIExternalBaseURL *url.URL `env:"OPENAPI_EXTERNAL_BASE_URL"`
// contains filtered or unexported fields
}
type HealthCheck ¶
type LambdaRelay ¶
type LambdaRelay struct {
Slug string
CreateHandlerFromSysClient func(any) bhttp.HandlerFunc[context.Context]
}
LambdaRelay adds a http endpoint that decodes a json object and calls the system service. This is used to let the service handle lambda calls.
func NewLambdaRelay ¶ added in v0.0.175
func NewLambdaRelay[C, E any](slug string, handler LambdaRelayHandler[C, E]) *LambdaRelay
NewLambdaRelay inits a lambda relay definition.
type LambdaRelayHandler ¶
type RPCBasePath ¶ added in v0.0.175
type RPCBasePath struct{ V string }
type to carry the rpc base path.
Click to show internal directories.
Click to hide internal directories.