Documentation
¶
Index ¶
- type Build
- type Config
- type EnvVars
- func InterpolateEnvVars(envVars EnvVars) (EnvVars, error)
- func LoadAllEnvForService(serviceName string, configEnv map[string]string) (EnvVars, error)
- func LoadEnvFile(filePath string) (EnvVars, error)
- func LoadProjectEnv() (EnvVars, error)
- func LoadServiceEnv(serviceName string) (EnvVars, error)
- func MergeEnvVars(envMaps ...EnvVars) EnvVars
- type HealthCheck
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct {
Context string `yaml:"context"` // Build context path
Dockerfile string `yaml:"dockerfile,omitempty"` // Dockerfile path (default: Dockerfile)
Args map[string]string `yaml:"args,omitempty"` // Build arguments
}
Build represents build configuration for building from source
type Config ¶
type Config struct {
Version string `yaml:"version"` // e.g., "1.0"
Project string `yaml:"project"` // Project name
Services map[string]Service `yaml:"services"` // Map of service name -> Service
}
Config represents the entire ork.yml file structure
type EnvVars ¶
EnvVars represents a collection of environment variables
func InterpolateEnvVars ¶
InterpolateEnvVars interpolates variable references in environment values Supports:
- ${VAR_NAME} - standard form
- $VAR_NAME - short form (word characters only)
- ${VAR_NAME:-default} - with default value
Variables are resolved from:
- The provided EnvVars map (for self-referencing)
- System environment variables (os.Getenv)
Returns an error if circular references are detected
func LoadAllEnvForService ¶
LoadAllEnvForService loads and merges all environment variables for a service Priority (lowest to highest):
- Project .env file
- Service-specific .env.<service> file
- Environment variables from the york.yml config
After merging, all variable references (${VAR} or $VAR) are interpolated
func LoadEnvFile ¶
LoadEnvFile loads environment variables from a .env file Returns an empty map if the file doesn't exist (not an error)
func LoadProjectEnv ¶
LoadProjectEnv loads the project-level .env file from the current directory Looks for .env in the directory where ork.yml is located
func LoadServiceEnv ¶
LoadServiceEnv loads service-specific .env file Looks for .env.<service-name> in the current directory
func MergeEnvVars ¶
MergeEnvVars merges multiple EnvVars maps with priority Later maps override earlier ones Example: MergeEnvVars(projectEnv, serviceEnv, configEnv) configEnv has highest priority, projectEnv has lowest
type HealthCheck ¶
type HealthCheck struct {
Endpoint string `yaml:"endpoint"` // HTTP endpoint to check (e.g., /health)
Interval string `yaml:"interval"` // Check interval (e.g., 5s)
Timeout string `yaml:"timeout"` // Request timeout (e.g., 3s)
Retries int `yaml:"retries"` // Number of retries before unhealthy
}
HealthCheck represents health check configuration
type Service ¶
type Service struct {
// Source configuration (mutually exclusive)
Git string `yaml:"git,omitempty"` // Git repo URL (e.g., github.com/org/repo)
Image string `yaml:"image,omitempty"` // Docker image (e.g., nginx:alpine)
Build *Build `yaml:"build,omitempty"` // Build from a local source
// Runtime configuration
Ports []string `yaml:"ports,omitempty"` // Port mappings (e.g., "3000:3000")
Env map[string]string `yaml:"env,omitempty"` // Environment variables
DependsOn []string `yaml:"depends_on,omitempty"` // Service dependencies
Health *HealthCheck `yaml:"health,omitempty"` // Health check config
Command []string `yaml:"command,omitempty"` // Override container command
Entrypoint []string `yaml:"entrypoint,omitempty"` // Override entrypoint
}
Service represents a single service definition