Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EdgeSubprocessEnv ¶
func EdgeSubprocessEnv(srv *serverconf.ServerConfig, apiExternalURLFallback string) []string
EdgeSubprocessEnv returns KEY=value pairs appended after os.Environ() for the Deno child. Go merges env with last-wins for duplicate keys, so these override inherited values.
Injected when non-empty:
- SUPATYPE_URL — from srv.SupatypeURL, else apiExternalURLFallback
- SUPATYPE_ANON_KEY — from srv.AnonKey
- SUPATYPE_SERVICE_ROLE_KEY — from srv.ServiceRoleKey
Additionally, any process env key starting with SUPATYPE_EDGE_ is passed with that prefix stripped (e.g. SUPATYPE_EDGE_FOO=1 → FOO=1) for user-defined function env.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager supervises a Deno process that serves edge functions. It spawns `deno run [--watch] --allow-net --allow-env --allow-read {serveEntry}` where serveEntry is the generated router (uses `Deno.serve` internally — equivalent role to a dedicated `deno serve` file server, but `deno run` is required for our multi-route TS entry). Restarts on crash with exponential backoff (1s → 2s → 4s → … → 30s cap). PORT must be communicated via environment; the child's PORT is overridden so it cannot inherit the main server's listen port by mistake.
func New ¶
New creates a Manager. serveEntry is the script path passed to `deno run` (router generated under .supatype/functions-router.ts during `supatype dev`). port is the port Deno will listen on. env is appended after inheriting OS env minus PORT= plus the explicit PORT=value for Deno children. When watch is true, `deno run --watch` reloads the worker when source files change.
func (*Manager) RecentLogs ¶
RecentLogs returns up to n log lines captured since the given time. If since is zero, all buffered lines are returned.