Documentation
¶
Overview ¶
Package app boots a Contexo server. It is the public seam the OSS server and private (contexo-backend) builds share: both call Run, and the private build passes extra Registrars that mount cloud-only routes on the authenticated /v1 group. Keeping this package public (not under internal/) lets a separate module build a Contexo server without copying the bootstrap or importing Contexo internals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v0.5.0
type Option func(*options)
Option configures Run. It is the open-core seam: a private build passes WithRegistrar (authenticated cloud routes), WithRootRegistrar (unauthenticated cloud routes), and/or WithQuota (hosted usage limits); the OSS server calls Run with no options and behaves exactly as before.
func WithQuota ¶ added in v0.5.0
WithQuota installs a hosted usage-limit policy (repo/member caps). Without it the server is uncapped — the correct default for OSS/self-host builds.
func WithRegistrar ¶ added in v0.5.0
WithRegistrar mounts cloud-only routes on the authenticated /v1 group. Nil registrars are ignored; it may be passed more than once.
func WithRootRegistrar ¶ added in v0.5.0
func WithRootRegistrar(r RootRegistrar) Option
WithRootRegistrar mounts an unauthenticated route group on the engine root (e.g. payment webhooks). Nil registrars are ignored; it may be passed more than once.
type Registrar ¶
type Registrar func(v1 *gin.RouterGroup)
Registrar mounts extra routes on the authenticated /v1 group. The handler reads the caller's identity from the gin context set by the auth middleware (e.g. c.GetString("user_id")). Only public types cross this boundary, so a separate module can implement one without importing Contexo internals.
type RootRegistrar ¶ added in v0.5.0
type RootRegistrar func(root *gin.RouterGroup)
RootRegistrar mounts routes on the engine root, outside the /v1 auth middleware — for endpoints that authenticate themselves (e.g. a Stripe webhook verified by signature rather than a bearer token).