Documentation
¶
Overview ¶
Package config loads docker-ops.yaml / docker-ops.yml and dq.env per readme §14.1.
Index ¶
- func DQEnvPath(root string) string
- func FindDockerOpsFile(root string) string
- func FormatYAMLParseError(filePath string, content []byte, parseErr error) error
- func ParseDQEnv(path string) (map[string]string, error)
- func ParseDeployImagesList(s string) map[string]string
- func RemoteYAMLTemplate(cfg *Config, anonymize bool) string
- func ResolveProjectRoot(flagDir string) (string, error)
- func ValidateBytes(label string, content []byte) error
- func ValidateFile(absPath string) error
- type Config
- type LoadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindDockerOpsFile ¶
FindDockerOpsFile returns the path to docker-ops.yaml or docker-ops.yml in root, or "" if neither exists.
func FormatYAMLParseError ¶
FormatYAMLParseError turns a low-level yaml parse error into a readable message with context.
func ParseDQEnv ¶
ParseDQEnv reads dq.env (dotenv-style). Empty values are omitted so they do not override YAML (§14.1).
func ParseDeployImagesList ¶ added in v1.1.3
ParseDeployImagesList parses "svc=image,svc2=image2" (comma between pairs) for the DEPLOY_IMAGES variable in dq.env or process environment (see §14.1). Image refs can contain colons; only the first = in each pair is the separator.
func RemoteYAMLTemplate ¶
RemoteYAMLTemplate generates docker-ops.yaml body (§5.4).
func ResolveProjectRoot ¶
ResolveProjectRoot returns the absolute project root from flag, DQ_PROJECT_ROOT, or cwd.
func ValidateBytes ¶
ValidateBytes parses YAML and validates. label is a path (used for messages and app_config resolution).
func ValidateFile ¶
ValidateFile parses docker-ops YAML and runs semantic checks (for `dq validate`).
Types ¶
type Config ¶
type Config struct {
ComposeProjectName string `yaml:"compose_project_name"`
ComposeFile string `yaml:"compose_file"`
ComposeService string `yaml:"compose_service"`
RemoteSSH string `yaml:"remote_ssh"`
RemotePath string `yaml:"remote_path"`
SSHIdentity string `yaml:"ssh_identity"`
Exclude []string `yaml:"exclude"`
RsyncExtra string `yaml:"rsync_extra"`
DeployMode string `yaml:"deploy_mode"`
DeployImage string `yaml:"deploy_image"`
// DeployImages maps compose service name → image ref for artifacts deploy when several
// services use build:. If set, each is built and pushed/save-loaded; deploy_image is ignored.
DeployImages map[string]string `yaml:"deploy_images"`
DeployPush *bool `yaml:"deploy_push"`
DeployUseRegistry *bool `yaml:"deploy_use_registry"`
DeploySaveLoad *bool `yaml:"deploy_save_load"`
DeploySaveCompress *bool `yaml:"deploy_save_compress"`
// DeployBuildRemote runs docker build (and registry push when not save/load) on the
// remote host after mirroring the project tree, instead of using the local Docker daemon.
DeployBuildRemote *bool `yaml:"deploy_build_remote"`
DeployInclude []string `yaml:"deploy_include"`
AppConfig string `yaml:"app_config"`
HelpShowEffective *bool `yaml:"help_show_effective"`
UseRemote *bool `yaml:"use_remote"` // false => force local (DOCKER_OPS_USE_REMOTE=0)
}
Config holds docker-ops YAML fields (snake_case in file).
func (*Config) ApplyDefaults ¶
ApplyDefaults sets compose defaults from project root directory name (§5.2).
func (*Config) HasDeployImageOrImages ¶ added in v1.1.3
HasDeployImageOrImages is true if deploy_image is non-empty or deploy_images has at least one non-empty tag. Use before requiring an image for artifacts deploy.
func (*Config) RemoteConfigured ¶
RemoteConfigured reports whether remote SSH mode is available (§5.1).
type LoadResult ¶
type LoadResult struct {
Config *Config
YAMLPath string // path to docker-ops yaml if found, else ""
ProjectRoot string
}
LoadResult carries loaded config and metadata.
func Load ¶
func Load(projectRoot string) (*LoadResult, error)
Load reads YAML (if present), merges dq.env, then process env — §14.1.