loader

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 28 Imported by: 63

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Load

func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error)

Load reads a ConfigDetails and returns a fully loaded configuration

func LoadConfigObjs

func LoadConfigObjs(source map[string]interface{}, details types.ConfigDetails, resolvePaths bool) (map[string]types.ConfigObjConfig, error)

LoadConfigObjs produces a ConfigObjConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation

func LoadNetworks

func LoadNetworks(source map[string]interface{}) (map[string]types.NetworkConfig, error)

LoadNetworks produces a NetworkConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation

func LoadSecrets

func LoadSecrets(source map[string]interface{}, details types.ConfigDetails, resolvePaths bool) (map[string]types.SecretConfig, error)

LoadSecrets produces a SecretConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation

func LoadService

func LoadService(name string, serviceDict map[string]interface{}, workingDir string, lookupEnv template.Mapping, resolvePaths bool, convertPaths bool) (*types.ServiceConfig, error)

LoadService produces a single ServiceConfig from a compose file Dict the serviceDict is not validated if directly used. Use Load() to enable validation

func LoadServices

func LoadServices(filename string, servicesDict map[string]interface{}, workingDir string, lookupEnv template.Mapping, opts *Options) ([]types.ServiceConfig, error)

LoadServices produces a ServiceConfig map from a compose file Dict the servicesDict is not validated if directly used. Use Load() to enable validation

func LoadVolumes

func LoadVolumes(source map[string]interface{}) (map[string]types.VolumeConfig, error)

LoadVolumes produces a VolumeConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation

func NormalizeProjectName added in v1.2.5

func NormalizeProjectName(s string) string

func ParseShortSSHSyntax added in v1.2.2

func ParseShortSSHSyntax(value string) ([]types.SSHKey, error)

ParseShortSSHSyntax parse short syntax for SSH authentications

func ParseVolume

func ParseVolume(spec string) (types.ServiceVolumeConfig, error)

ParseVolume parses a volume spec without any knowledge of the target platform

func ParseYAML

func ParseYAML(source []byte) (map[string]interface{}, error)

ParseYAML reads the bytes from a file, parses the bytes into a mapping structure, and returns it.

func Transform

func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) 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 WithSkipValidation

func WithSkipValidation(opts *Options)

WithSkipValidation sets the Options to skip validation when loading sections

Types

type ForbiddenPropertiesError

type ForbiddenPropertiesError struct {
	Properties map[string]string
}

ForbiddenPropertiesError is returned when there are properties in the Compose file that are forbidden.

func (*ForbiddenPropertiesError) Error

func (e *ForbiddenPropertiesError) Error() string

type Options

type Options struct {
	// Skip schema validation
	SkipValidation bool
	// Skip interpolation
	SkipInterpolation bool
	// Skip normalization
	SkipNormalization bool
	// Resolve paths
	ResolvePaths bool
	// Convert Windows paths
	ConvertWindowsPaths bool
	// Skip consistency check
	SkipConsistencyCheck bool
	// Skip extends
	SkipExtends bool
	// Interpolation options
	Interpolate *interp.Options
	// contains filtered or unexported fields
}

Options supported by Load

func (Options) GetProjectName added in v1.1.0

func (o Options) GetProjectName() (string, bool)

func (*Options) SetProjectName added in v1.1.0

func (o *Options) SetProjectName(name string, imperativelySet bool)

type Transformer

type Transformer struct {
	TypeOf reflect.Type
	Func   TransformerFunc
}

Transformer defines a map to type transformer

type TransformerFunc

type TransformerFunc func(interface{}) (interface{}, error)

TransformerFunc defines a function to perform the actual transformation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL