Documentation
¶
Index ¶
- func ValidateDomain(domain string) error
- func ValidateFiles(files map[string]string) error
- func ValidateHealthCheck(hc *HealthCheck) error
- func ValidateName(name string) error
- func ValidatePath(path string) error
- func ValidatePortMapping(mapping string) error
- func ValidateServer(server string) error
- func ValidateStackPath(path string) error
- func ValidateTarget(target string) error
- func ValidateVolumeName(name string) error
- type Config
- type Dependencies
- type Dependency
- type DeployConfig
- type HealthCheck
- type RootConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateDomain ¶
ValidateDomain validates a domain name for security and correctness
func ValidateFiles ¶ added in v0.9.0
ValidateFiles validates the files mapping for security and correctness. Keys are local relative paths, values are absolute container mount paths.
func ValidateHealthCheck ¶
func ValidateHealthCheck(hc *HealthCheck) error
ValidateHealthCheck validates a healthcheck configuration for security and correctness
func ValidateName ¶
ValidateName validates a service name for security and correctness
func ValidatePath ¶ added in v0.1.0
ValidatePath validates a URL path prefix for Traefik routing
func ValidatePortMapping ¶ added in v0.8.0
ValidatePortMapping validates a Docker port mapping string (e.g., "3000:3000", "8080:80")
func ValidateServer ¶
ValidateServer validates a server hostname/identifier Returns an error if the server name contains shell metacharacters or is invalid
func ValidateStackPath ¶
ValidateStackPath validates a stack path for security and correctness
func ValidateTarget ¶ added in v0.1.4
ValidateTarget validates a Docker build target stage name
func ValidateVolumeName ¶
ValidateVolumeName validates a Docker volume name for security and correctness
Types ¶
type Config ¶
type Config struct {
Name string `yaml:"name"`
Server string `yaml:"server"`
Stack string `yaml:"stack"`
Dockerfile string `yaml:"dockerfile"`
Context string `yaml:"context"`
Domain string `yaml:"domain"` // optional, enables Traefik (single domain)
Domains []string `yaml:"domains"` // optional, multi-domain support
RedirectTo string `yaml:"redirect_to"` // optional, domain to redirect all others to (must be in Domains)
Path string `yaml:"path"` // optional, path prefix for Traefik routing
HTTPS *bool `yaml:"https"` // default true, pointer for nil check
Port int `yaml:"port"` // default 80
Image string `yaml:"image"` // if set, skip build (pre-built)
Ports []string `yaml:"ports"` // host:container port mappings
Target string `yaml:"target"` // Docker build target stage
Deploy *DeployConfig `yaml:"deploy"` // deployment strategy options
DependsOn Dependencies `yaml:"depends_on"`
Volumes map[string]string `yaml:"volumes"` // name: mount_path
Files map[string]string `yaml:"files"` // local_path: container_mount_path
HealthCheck *HealthCheck `yaml:"healthcheck"`
}
Config represents a single service configuration
func (*Config) AliasDomains ¶ added in v0.2.0
AliasDomains returns domains that should redirect to the primary domain Returns nil if using single Domain field or if redirect_to is not set When redirect_to is set, returns all domains except redirect_to
func (*Config) DeployStrategy ¶ added in v0.5.0
DeployStrategy returns the deploy strategy for this config
func (*Config) IsPrebuilt ¶
IsPrebuilt returns true if this config uses a pre-built image
func (*Config) PrimaryDomain ¶ added in v0.2.0
PrimaryDomain returns the primary domain for this config Returns redirect_to if set, otherwise Domain field, otherwise first domain from Domains array Returns empty string if none are set
type Dependencies ¶ added in v0.4.0
type Dependencies []Dependency
Dependencies can be unmarshaled from either a YAML sequence of strings or a YAML mapping with conditions.
func (Dependencies) HasConditions ¶ added in v0.4.0
func (d Dependencies) HasConditions() bool
HasConditions returns true if any dependency specifies a condition.
func (Dependencies) Names ¶ added in v0.4.0
func (d Dependencies) Names() []string
Names returns the dependency names as a string slice.
func (*Dependencies) UnmarshalYAML ¶ added in v0.4.0
func (d *Dependencies) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML handles both list and map forms of depends_on.
type Dependency ¶ added in v0.4.0
Dependency represents a service dependency with an optional condition.
type DeployConfig ¶ added in v0.5.0
type DeployConfig struct {
Strategy string `yaml:"strategy"` // "rollout" (default) or "recreate"
}
DeployConfig holds deployment strategy options
type HealthCheck ¶
type HealthCheck struct {
Cmd string `yaml:"cmd"`
Interval string `yaml:"interval"`
Timeout string `yaml:"timeout"`
Retries int `yaml:"retries"`
}
HealthCheck represents Docker healthcheck configuration
type RootConfig ¶
type RootConfig struct {
Server string `yaml:"server"`
Stack string `yaml:"stack"`
Deploy *DeployConfig `yaml:"deploy"`
Services map[string]*Config `yaml:"services"`
}
RootConfig represents the ssd.yaml file structure
func Load ¶
func Load(path string) (*RootConfig, error)
Load reads and parses ssd.yaml from the current directory or specified path
func LoadFromBytes ¶
func LoadFromBytes(data []byte) (*RootConfig, error)
LoadFromBytes parses raw YAML bytes into RootConfig Does not panic on any input, returns error instead Enables fuzz testing without file system
func (*RootConfig) GetService ¶
func (r *RootConfig) GetService(serviceName string) (*Config, error)
GetService returns the configuration for a specific service serviceName is required when Services map exists
func (*RootConfig) IsSingleService ¶
func (r *RootConfig) IsSingleService() bool
IsSingleService returns true if this is a single-service config
func (*RootConfig) ListServices ¶
func (r *RootConfig) ListServices() []string
ListServices returns all service names in a multi-service config