app

package
v0.6.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 15 Imported by: 0

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

func Run

func Run(opts ...Option) error

Run boots the Contexo server from environment configuration and blocks serving HTTP. Options let a private build add cloud-only routes and usage limits; the OSS server calls Run with none and behaves exactly as before.

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

func WithQuota(p quota.Policy) Option

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

func WithRegistrar(r Registrar) Option

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL