Documentation
¶
Overview ¶
Package config loads docker-ops.yaml / docker-ops.yml and dq.env per readme §14.1.
Index ¶
- Constants
- func DQEnvPath(root string) string
- func EffectiveComposeFile(c *Config, projectRoot string) string
- func EffectiveDeployEngine(c *Config) string
- func EffectiveDeployLayerSync(c *Config) bool
- func EffectiveDeploySkipUnchanged(c *Config) bool
- func FindDockerOpsFile(root string) string
- func FormatYAMLParseError(filePath string, content []byte, parseErr error) error
- func ModeIsArtifacts(c *Config) bool
- func ParseDQEnv(path string) (map[string]string, error)
- func ParseDeployImagesList(s string) map[string]string
- func RemoteDockerSocketExplicit(c *Config) (path string, ok bool)
- func RemoteYAMLTemplate(cfg *Config, anonymize bool) string
- func ResolveProjectRoot(flagDir string) (string, error)
- func UsesDeployAPI(c *Config) bool
- func ValidateBytes(label string, content []byte) error
- func ValidateFile(absPath string) error
- type Config
- type LoadResult
Constants ¶
const ( DeployEngineCompose = "compose" DeployEngineAuto = "auto" DeployEngineAPI = "api" )
const ArtifactsComposeFileName = "docker-compose.image.yml"
ArtifactsComposeFileName is the compose file delivered on artifacts deploy.
Variables ¶
This section is empty.
Functions ¶
func EffectiveComposeFile ¶ added in v1.1.4
EffectiveComposeFile returns the compose file path (relative to project root) used by dq ps/up/down/logs/exec so API and compose deploy target the same project definition.
func EffectiveDeployEngine ¶ added in v1.1.4
EffectiveDeployEngine returns compose when unset (backward compatible).
func EffectiveDeployLayerSync ¶ added in v1.1.4
EffectiveDeployLayerSync defaults to true when unset.
func EffectiveDeploySkipUnchanged ¶ added in v1.1.4
EffectiveDeploySkipUnchanged defaults to true when unset.
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 ModeIsArtifacts ¶ added in v1.1.4
ModeIsArtifacts reports deploy_mode == artifacts (case-insensitive).
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 RemoteDockerSocketExplicit ¶ added in v1.1.4
RemoteDockerSocketExplicit reports a non-auto explicit unix socket path from config.
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 UsesDeployAPI ¶ added in v1.1.4
UsesDeployAPI reports whether artifacts deploy may use Docker Engine API paths.
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)
// DeployEngine controls artifacts finish: compose (default), auto (API with compose fallback), api.
DeployEngine string `yaml:"deploy_engine"`
// RemoteDockerSocket is unix path on remote host, or "auto" to detect (used with deploy_engine auto|api).
RemoteDockerSocket string `yaml:"remote_docker_socket"`
// RemoteDockerSocketService optional systemd unit to inspect for socket path (e.g. docker.socket).
RemoteDockerSocketService string `yaml:"remote_docker_socket_service"`
DeploySkipUnchanged *bool `yaml:"deploy_skip_unchanged"`
DeployLayerSync *bool `yaml:"deploy_layer_sync"`
}
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.