Documentation
¶
Overview ¶
Package startupview renders the report a Nimbus app prints when it boots.
It lives apart from the App because two different processes need to draw it. A direct `go run .` renders the view itself. Under `nimbus serve` the app is a child of Air with a pipe for stdout — it can neither colour its output nor know when the CLI is ready for it — so it emits the same facts as a single-line marker and the CLI, which does own a terminal, renders them. One renderer, one look, however the app was started.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorEnabled ¶
func ColorEnabled() bool
ColorEnabled reports whether this process will colour the view.
func DescribeDSN ¶
DescribeDSN reduces a connection string to something safe to print: a file path stays as it is, a URL keeps only host and database, and credentials never appear.
func FormatDuration ¶
FormatDuration renders a boot duration the way it is talked about.
func LANAddress ¶
func LANAddress() string
LANAddress finds the machine's address on the local network, so the URL can be opened from a phone or another machine.
func RenderLaunch ¶
RenderLaunch draws the line shown the moment `nimbus serve` starts.
It exists because the boot report cannot: that one needs a running app, and between the command being typed and the app being up there is a compile, an asset build and — in a real project — schema migrations. That gap was silent, which reads as a hang rather than as work in progress. This says what is happening immediately, and the boot report replaces it when the app is actually serving.
Types ¶
type Info ¶
type Info struct {
Name string `json:"name"`
Env string `json:"env"`
Version string `json:"version"`
Go string `json:"go"`
OS string `json:"os"`
Arch string `json:"arch"`
Scheme string `json:"scheme"`
Port string `json:"port"`
LAN string `json:"lan,omitempty"`
DBDriver string `json:"db_driver,omitempty"`
DBSource string `json:"db_source,omitempty"`
Providers int `json:"providers"`
Plugins int `json:"plugins"`
Routes int `json:"routes"`
RouteCompile time.Duration `json:"route_compile"`
ViewExt string `json:"view_ext,omitempty"`
ViewLiveReload bool `json:"view_live_reload,omitempty"`
Booted time.Duration `json:"booted"`
Watching bool `json:"watching,omitempty"`
}
Info is everything the boot report shows. It crosses a process boundary as JSON, so every field is exported and tagged.
func ParseMarker ¶
ParseMarker decodes a marker line. It also understands the pipe-delimited form emitted by apps built against nimbus ≤ v1.5.4, so a new CLI in front of an older app still shows something sensible rather than a raw marker.