Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllServices ¶
func AllServices(files []*ComposeFile) []string
AllServices returns a flat list of all compose service names across all files.
func ContainerName ¶
func ContainerName(files []*ComposeFile, svcName string) string
ContainerName returns the docker container_name for a compose service.
func FilePaths ¶
func FilePaths(files []*ComposeFile) []string
FilePaths returns just the paths from a list of ComposeFiles.
func ShortNameMap ¶
func ShortNameMap(files []*ComposeFile) map[string]string
ShortNameMap builds a map of short-name → service name across all resolved compose files. The schemaf extension on the compose file level defines a short name for the whole file's primary service; per-service x-schemaf.short-name overrides for individual services.
Types ¶
type ComposeFile ¶
type ComposeFile struct {
Path string // absolute path
Dir string // directory containing the file
Schemaf *SchemafExtension
Services map[string]ServiceDef
}
ComposeFile represents a parsed compose file with its metadata
func Resolve ¶
func Resolve(entryPaths []string) ([]*ComposeFile, error)
Resolve walks the dependency graph starting from the given compose file paths. Returns an ordered list of compose file paths (dependencies before dependents), deduplicated.
type HealthConfig ¶
type HealthConfig struct {
Type string `yaml:"type"` // "http" or "redis_ping"
Path string `yaml:"path"` // for http
}
HealthConfig describes how to health-check a service
type SchemafExtension ¶
type SchemafExtension struct {
Project string `yaml:"project"`
ShortName string `yaml:"short-name"`
DependsOnCompose []string `yaml:"depends-on-compose"`
Health *HealthConfig `yaml:"health"`
NativeStop string `yaml:"native-stop"`
DevInstructions string `yaml:"dev-instructions"`
EnvOverridesWhenAbsent map[string]string `yaml:"env-overrides-when-absent"`
// Database configuration for dev/test environments
DBPort int `yaml:"db-port"` // host port the postgres service is mapped to
DevDBPass string `yaml:"dev-db-pass"` // password used in dev/test (default: "dev")
}
SchemafExtension holds the x-schemaf metadata from a compose file
func FindSchemafByService ¶
func FindSchemafByService(files []*ComposeFile, svcName string) *SchemafExtension
FindSchemafByService looks up the SchemafExtension for a given compose service name.
type ServiceDef ¶
type ServiceDef struct {
ContainerName string
Schemaf *SchemafExtension
}
ServiceDef holds the parts of a compose service we care about