Documentation
¶
Overview ¶
Package detect reads a directory and reports the services grat could manage there.
A detector answers one question: given these files, what command would start this project, and what would that service be called. It answers only where the files say so. Where a marker is present but the detail cannot be read, the finding records that instead, because a plausible command that does not work costs more than no command at all: it looks right in the configuration and fails at the first start.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
// Root is the directory that was inspected.
Root string
// Services are the ones that could be derived completely.
Services []Service
// Unresolved are the markers that were recognised but not understood.
Unresolved []Unresolved
}
Finding is everything one directory yielded.
type Service ¶
type Service struct {
// Name is what the service is called in the configuration. The role follows
// from it through config.InferRole.
Name string
// Command is the complete foreground command, with $PORT where the service
// takes its port from the environment.
Command string
// Role is what the name implies, resolved here so a caller does not repeat it.
Role config.Role
// Evidence is the file the command was derived from, relative to the project
// root, so a person can check the answer against the thing it came from.
Evidence string
}
Service is one thing grat could manage, derived from what a directory holds.
type Unresolved ¶
type Unresolved struct {
// Marker is the file that identified the stack, relative to the project root.
Marker string
// Reason says what could not be read out of it.
Reason string
}
Unresolved records a marker that was recognised without yielding a command. It carries what was found and what could not be determined, so the caller can say that rather than invent the missing part.