Documentation
¶
Index ¶
- func ApplyExtends(ctx context.Context, dict map[string]any, workingdir string, opts *Options, ...) error
- func ApplyInclude(ctx context.Context, configDetails types.ConfigDetails, model map[string]any, ...) error
- func InvalidProjectNameErr(v string) error
- func IsServiceDependency(ref string) (string, bool)
- func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error)
- func LoadWithContext(ctx context.Context, configDetails types.ConfigDetails, ...) (*types.Project, error)
- func Normalize(project *types.Project) error
- func NormalizeProjectName(s string) string
- func ParseYAML(source []byte) (map[string]interface{}, error)
- func ResolveRelativePaths(project *types.Project) error
- func Transform(source interface{}, target interface{}) error
- func WithDiscardEnvFiles(opts *Options)
- func WithProfiles(profiles []string) func(*Options)
- func WithSkipValidation(opts *Options)
- type Options
- type PostProcessor
- type ResetProcessor
- type ResourceLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyExtends ¶
func ApplyInclude ¶
func InvalidProjectNameErr ¶
func IsServiceDependency ¶
IsServiceDependency check the relation set by ref refers to a service
func Load ¶
Load reads a ConfigDetails and returns a fully loaded configuration. Deprecated: use LoadWithContext.
func LoadWithContext ¶
func LoadWithContext(ctx context.Context, configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error)
LoadWithContext reads a ConfigDetails and returns a fully loaded configuration
func Normalize ¶
Normalize compose project by moving deprecated attributes to their canonical position and injecting implicit defaults
func NormalizeProjectName ¶
func ParseYAML ¶
ParseYAML reads the bytes from a file, parses the bytes into a mapping structure, and returns it.
func ResolveRelativePaths ¶
ResolveRelativePaths resolves relative paths based on project WorkingDirectory
func Transform ¶
func Transform(source interface{}, target interface{}) error
Transform converts the source into the target struct with compose types transformer and the specified transformers if any.
func WithDiscardEnvFiles ¶
func WithDiscardEnvFiles(opts *Options)
WithDiscardEnvFiles sets the Options to discard the `env_file` section after resolving to the `environment` section
func WithProfiles ¶
WithProfiles sets profiles to be activated
func WithSkipValidation ¶
func WithSkipValidation(opts *Options)
WithSkipValidation sets the Options to skip validation when loading sections
Types ¶
type Options ¶
type Options struct {
// Skip schema validation
SkipValidation bool
// Skip interpolation
SkipInterpolation bool
// Skip normalization
SkipNormalization bool
// Resolve path
ResolvePaths bool
// Convert Windows path
ConvertWindowsPaths bool
// Skip consistency check
SkipConsistencyCheck bool
// Skip extends
SkipExtends bool
// SkipInclude will ignore `include` and only load model from file(s) set by ConfigDetails
SkipInclude bool
// SkipResolveEnvironment will ignore computing `environment` for services
SkipResolveEnvironment bool
// Interpolation options
Interpolate *interp.Options
// Profiles set profiles to enable
Profiles []string
// ResourceLoaders manages support for remote resources
ResourceLoaders []ResourceLoader
// contains filtered or unexported fields
}
Options supported by Load
func (Options) GetProjectName ¶
func (*Options) SetProjectName ¶
type PostProcessor ¶
type PostProcessor interface {
yaml.Unmarshaler
// Apply changes to compose model based on recorder metadata
Apply(interface{}) error
}
PostProcessor is used to tweak compose model based on metadata extracted during yaml Unmarshal phase that hardly can be implemented using go-yaml and mapstructure
type ResetProcessor ¶
type ResetProcessor struct {
// contains filtered or unexported fields
}
func (*ResetProcessor) Apply ¶
func (p *ResetProcessor) Apply(target any) error
Apply finds the go attributes matching recorded paths and reset them to zero value
func (*ResetProcessor) UnmarshalYAML ¶
func (p *ResetProcessor) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implement yaml.Unmarshaler
type ResourceLoader ¶
type ResourceLoader interface {
// Accept returns `true` is the resource reference matches ResourceLoader supported protocol(s)
Accept(path string) bool
// Load returns the path to a local copy of remote resource identified by `path`.
Load(ctx context.Context, path string) (string, error)
}
ResourceLoader is a plugable remote resource resolver