Documentation
¶
Overview ¶
Package compose locates compose files and inspects how they declare ports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base ¶
Base is the file wtc reads. It stops at the first match and never looks at override files, so a port parametrised only in an override stays invisible to it.
func Files ¶
Files reproduces docker compose's auto-detection, needed whenever an extra -f is passed since that forces every file to be named explicitly.
func PortLabel ¶
func PortLabel(s ServicePort) string
PortLabel distinguishes the several ports of one service, using the part of the variable name that is not the service name: MAILHOG_WEB_PORT on service mailhog becomes "web".
Types ¶
type ServicePort ¶
type ServicePort struct {
Service string
// Var is the environment variable wtc overrides, empty when the port is
// hardcoded and therefore not isolatable.
Var string
Host string // host port declared as the default
Container string // container side, which is what tells a web port apart
}
ServicePort is one published port of a service, as declared in the base compose file.
func MergedServicePorts ¶
func MergedServicePorts(dir string) ([]ServicePort, error)
MergedServicePorts reads the base file then lets the project's own override win, service by service. A project that already remaps its ports on purpose (to avoid a clash on the machine) must keep that mapping as the reference, otherwise rebasing from the base file would silently undo it.
func ServicePorts ¶
func ServicePorts(path string) ([]ServicePort, error)
ServicePorts lists the published ports per service. It reads the base file only, mirroring wtc, which never merges override files.
func (ServicePort) IsWeb ¶
func (s ServicePort) IsWeb() bool
IsWeb reports whether this port is worth prefixing with http://.