httpserver

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 63 Imported by: 0

Documentation

Overview

Package httpserver wires the Cypra HTTP surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTenantDeletionCleanup

func RunTenantDeletionCleanup(ctx context.Context, db *sql.DB, cutoff time.Time) error

RunTenantDeletionCleanup permanently removes tenants whose deletion window has elapsed.

func RunTenantDeletionCleanupTicker

func RunTenantDeletionCleanupTicker(ctx context.Context, db *sql.DB, interval time.Duration) error

RunTenantDeletionCleanupTicker runs tenant deletion cleanup immediately and then on interval.

Types

type Options

type Options struct {
	DB             *sql.DB
	TenantDB       *db.TenantScopedDB
	PublicBaseURL  string
	Version        string
	Commit         string
	Logger         *slog.Logger
	DevOpenAPI     bool
	StorageReady   func(context.Context) error
	KEKLoaded      bool
	MasterKey      []byte
	BotVerifier    botmitigation.Verifier
	GoogleSecret   []byte
	GoogleAuthURL  string
	DashboardFS    fs.FS
	DashboardDev   string
	Storage        storage.Store
	StorageBackend string
	// TrustDevHeaders gates whether the auth middleware honors the
	// X-Cypra-Instance-Admin / X-Cypra-Tenant-Role / X-Cypra-User-Id elevation
	// headers. Tests and trusted proxies set this; production must not.
	TrustDevHeaders bool
	// TrustedProxyHeaders gates whether X-Forwarded-* headers are honored for
	// host, scheme, and client IP. It is configured server-side only.
	TrustedProxyHeaders bool
	BlockTerminalEmail  bool
}

type Server

type Server struct {
	Options
	// contains filtered or unexported fields
}

func New

func New(opts Options) (*Server, error)

func (*Server) Router

func (s *Server) Router() http.Handler

type Tenant

type Tenant struct {
	ID   uuid.UUID
	Slug string
}

func TenantFromContext

func TenantFromContext(ctx context.Context) (Tenant, bool)

Jump to

Keyboard shortcuts

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