Documentation
¶
Overview ¶
Package server assembles the ably-server process: flag/env/config parsing, storage/realtime/REST wiring, HTTP routing, and graceful shutdown. cmd/ably-server is a thin wrapper that calls Run; tests (including the //go:build integration SDK suites in internal/server/integrationtest) call Run directly so they can discover ephemeral listener addresses via Opts.Ready/DebugReady without shelling out to a built binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Opts ¶
type Opts struct {
// Args is the slice of CLI args (excluding os.Args[0]).
Args []string
// Getenv resolves an environment variable; tests pass a stub.
Getenv func(string) string
// Out is the writer used for logs and flag-parsing errors.
Out io.Writer
// Ready, when non-nil, receives the bound listener's address once
// net.Listen returns — used by tests that pass --listen=:0 to
// discover the ephemeral port. The send is bounded by ctx so a
// missing receiver does not deadlock startup.
Ready chan<- net.Addr
// DebugReady, when non-nil, receives the bound debug listener's
// address once it starts — used by tests that pass
// --debug-listen=:0 to discover the ephemeral port. Only sent to
// when --debug-listen is set; the send is bounded by ctx.
DebugReady chan<- net.Addr
}
Opts bundles Run's inputs so the production main() and tests share one entry point. Args/Getenv/Out are required; Ready is an optional testing hook (see field doc).
Click to show internal directories.
Click to hide internal directories.