Documentation
¶
Overview ¶
Package app is the main of a generated Surface binary: it starts Substrate (config, logging, health, the HTTP host, the database), hands the core what Substrate opened, and serves. A generated main.go is one call to Main.
Substrate supplies the mechanism; Surface is the app on top of it. The app's own settings are not Substrate config: they live in the app's database and change live (see the core). Substrate's config holds only what must be known before the database opens: the listen address, the log level, the database path.
Index ¶
Constants ¶
const AuthIdentity = "identity"
AuthIdentity is the Config.Auth value that turns sign-in on.
Variables ¶
This section is empty.
Functions ¶
func DataDir ¶
DataDir is where the app keeps its data: <APP>_DATA_DIR, or the app's directory under XDG_DATA_HOME (default ~/.local/share).
Types ¶
type Config ¶
type Config struct {
// Name is the app's name; Title is how a person reads it.
Name string
Title string
// Modules are the Surface modules to start, in order (surface_wiring.go).
Modules []string
// SubstrateModules and SubstrateConfigJSON come from substrate_wiring.go.
SubstrateModules []string
SubstrateConfigJSON string
// Assets is the built page, or nil.
Assets fs.FS
// Ready, when set, learns the bound address (tests listen on port 0).
Ready func(net.Addr)
// Auth is "" (or "off": one owner, loopback only, no sign-in) or AuthIdentity: people
// sign in through Substrate's identity module (app/auth.go). surface.yaml's auth sets it.
Auth string
}
Config is what the generated wiring gives Main.