Documentation ¶
Index ¶
- Constants
- Variables
- func ProjectFromOptions(options *ProjectOptions) (*types.Project, error)
- func WithConfigFileEnv(o *ProjectOptions) error
- func WithDefaultConfigPath(o *ProjectOptions) error
- func WithDiscardEnvFile(o *ProjectOptions) error
- func WithDotEnv(o *ProjectOptions) error
- func WithOsEnv(o *ProjectOptions) error
- type ProjectOptions
- type ProjectOptionsFn
- func WithEnv(env []string) ProjectOptionsFn
- func WithEnvFile(file string) ProjectOptionsFn
- func WithInterpolation(interpolation bool) ProjectOptionsFn
- func WithLoadOptions(loadOptions ...func(*loader.Options)) ProjectOptionsFn
- func WithName(name string) ProjectOptionsFn
- func WithNormalization(normalization bool) ProjectOptionsFn
- func WithResolvedPaths(resolve bool) ProjectOptionsFn
- func WithWorkingDirectory(wd string) ProjectOptionsFn
Constants ¶
const ( ComposeProjectName = "COMPOSE_PROJECT_NAME" ComposePathSeparator = "COMPOSE_PATH_SEPARATOR" ComposeFilePath = "COMPOSE_FILE" )
Variables ¶
var DefaultFileNames = []string{"compose.yaml", "compose.yml", "docker-compose.yml", "docker-compose.yaml"}
DefaultFileNames defines the Compose file names for auto-discovery (in order of preference)
var DefaultOverrideFileNames = []string{"compose.override.yml", "compose.override.yaml", "docker-compose.override.yml", "docker-compose.override.yaml"}
DefaultOverrideFileNames defines the Compose override file names for auto-discovery (in order of preference)
Functions ¶
func ProjectFromOptions ¶
func ProjectFromOptions(options *ProjectOptions) (*types.Project, error)
ProjectFromOptions load a compose project based on command line options
func WithConfigFileEnv ¶
func WithConfigFileEnv(o *ProjectOptions) error
WithConfigFileEnv allow to set compose config file paths by COMPOSE_FILE environment variable
func WithDefaultConfigPath ¶
func WithDefaultConfigPath(o *ProjectOptions) error
WithDefaultConfigPath searches for default config files from working directory
func WithDiscardEnvFile ¶
func WithDiscardEnvFile(o *ProjectOptions) error
WithDiscardEnvFiles sets discards the `env_file` section after resolving to the `environment` section
func WithDotEnv ¶
func WithDotEnv(o *ProjectOptions) error
WithDotEnv imports environment variables from .env file
func WithOsEnv ¶
func WithOsEnv(o *ProjectOptions) error
WithOsEnv imports environment variables from OS
Types ¶
type ProjectOptions ¶
type ProjectOptions struct { Name string WorkingDir string ConfigPaths []string Environment map[string]string EnvFile string // contains filtered or unexported fields }
ProjectOptions groups the command line options recommended for a Compose implementation
func NewProjectOptions ¶
func NewProjectOptions(configs []string, opts ...ProjectOptionsFn) (*ProjectOptions, error)
NewProjectOptions creates ProjectOptions
func (ProjectOptions) GetWorkingDir ¶
func (o ProjectOptions) GetWorkingDir() (string, error)
type ProjectOptionsFn ¶
type ProjectOptionsFn func(*ProjectOptions) error
func WithEnv ¶
func WithEnv(env []string) ProjectOptionsFn
WithEnv defines a key=value set of variables used for compose file interpolation
func WithEnvFile ¶
func WithEnvFile(file string) ProjectOptionsFn
WithEnvFile set an alternate env file
func WithInterpolation ¶
func WithInterpolation(interpolation bool) ProjectOptionsFn
WithInterpolation set ProjectOptions to enable/skip interpolation
func WithLoadOptions ¶
func WithLoadOptions(loadOptions ...func(*loader.Options)) ProjectOptionsFn
WithLoadOptions provides a hook to control how compose files are loaded
func WithNormalization ¶
func WithNormalization(normalization bool) ProjectOptionsFn
WithNormalization set ProjectOptions to enable/skip normalization
func WithResolvedPaths ¶
func WithResolvedPaths(resolve bool) ProjectOptionsFn
WithResolvedPaths set ProjectOptions to enable paths resolution
func WithWorkingDirectory ¶
func WithWorkingDirectory(wd string) ProjectOptionsFn
WithWorkingDirectory defines ProjectOptions' working directory