server

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 50 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Send-email hook receiver (POST /internal/v0hooks/send-email).

GoTrue is configured with GOTRUE_HOOK_SEND_EMAIL_ENABLED=true, GOTRUE_HOOK_SEND_EMAIL_URI pointing at this path (or any HTTPS URL for an Edge Function), and GOTRUE_HOOK_SEND_EMAIL_SECRETS matching Standard Webhooks v1 symmetric secrets (same format as outbound hooks). GoTrue then POSTs the payload to that URI instead of calling the mailer directly; this handler verifies the signature and runs DeliverInboundSendEmailHook (same templated path as direct sends).

In local dev, supatype.config.ts `email.send_email_hook` wires these env vars; optional `send_email_hook_uri` / `send_email_hook_secrets` override defaults.

Package server exposes the full supatype-server HTTP surface (auth, admin, rest, graphql, storage, functions, realtime, studio, platform) as an importable handler so it can be embedded in-process by other binaries (e.g. the Supatype Cloud metering/liveness gateway) without re-implementing the bootstrap or adding a network hop.

New performs the same bootstrap that `supatype-server serve` does, minus the listener/TLS/graceful-shutdown loop (which the caller owns). Stock binary behaviour is preserved: cmd/serve_cmd.go calls New and then runs the unchanged listen loop, so routes and config handling are identical.

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFile = ""
	WatchDir   = ""
)

ConfigFile and WatchDir mirror the `-c` / `-d` CLI flags. The stock binary sets these from cobra before calling New; embedders (cloud gateway) leave them empty to load configuration from the environment only.

Functions

func New

func New(ctx context.Context) (http.Handler, func(), error)

New builds the full supatype-server outer handler and starts its background workers (apiworker + optional config reloader), which stop when ctx is cancelled. The returned drain func waits for those workers and releases resources (Deno subprocess, Valkey, database); call it after cancelling ctx.

New does not bind a listener or configure TLS — the caller serves the returned handler however it likes (stock binary: cmd/serve_cmd.go; cloud: the metering gateway on :9999).

func WithOuterAccessLogContext

func WithOuterAccessLogContext(mode, managedProjectRef string) func(http.Handler) http.Handler

WithOuterAccessLogContext attaches mode and optional managed project ref to the request context so JSON access lines can emit `mode` and resolve `tenant` per A21.

Types

This section is empty.

Jump to

Keyboard shortcuts

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