config

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config loads docker-ops.yaml / docker-ops.yml and dq.env per readme §14.1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DQEnvPath

func DQEnvPath(root string) string

DQEnvPath returns the path to dq.env in project root.

func FindDockerOpsFile

func FindDockerOpsFile(root string) string

FindDockerOpsFile returns the path to docker-ops.yaml or docker-ops.yml in root, or "" if neither exists.

func FormatYAMLParseError

func FormatYAMLParseError(filePath string, content []byte, parseErr error) error

FormatYAMLParseError turns a low-level yaml parse error into a readable message with context.

func ParseDQEnv

func ParseDQEnv(path string) (map[string]string, error)

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

func ParseDeployImagesList(s string) map[string]string

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

func RemoteYAMLTemplate(cfg *Config, anonymize bool) string

RemoteYAMLTemplate generates docker-ops.yaml body (§5.4).

func ResolveProjectRoot

func ResolveProjectRoot(flagDir string) (string, error)

ResolveProjectRoot returns the absolute project root from flag, DQ_PROJECT_ROOT, or cwd.

func ValidateBytes

func ValidateBytes(label string, content []byte) error

ValidateBytes parses YAML and validates. label is a path (used for messages and app_config resolution).

func ValidateFile

func ValidateFile(absPath string) error

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

func (c *Config) ApplyDefaults(projectRoot string)

ApplyDefaults sets compose defaults from project root directory name (§5.2).

func (*Config) HasDeployImageOrImages added in v1.1.3

func (c *Config) HasDeployImageOrImages() bool

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

func (c *Config) RemoteConfigured() bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL