Documentation
¶
Index ¶
- Constants
- Variables
- func IsWorkdirInitialized(dir string) bool
- func Load(details config.ConfigDetails, options ...func(*LoaderOptions)) (*app.ApplicationConfig, error)
- func LoadLibraries(source map[string]interface{}, opts *LoaderOptions) (map[string]lib.LibraryConfig, error)
- func LoadTargets(source []interface{}, configDetails config.ConfigDetails, outdir string, ...) ([]target.TargetConfig, error)
- func LoadUnikraft(source interface{}, opts *LoaderOptions) (core.UnikraftConfig, error)
- func NewApplicationFromOptions(popts *ProjectOptions, copts ...component.ComponentOption) (*app.ApplicationConfig, error)
- func ParseYAML(source []byte) (map[string]interface{}, error)
- func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) error
- func Validate(config map[string]interface{}) error
- func WithSkipValidation(opts *LoaderOptions)
- type LoaderOptions
- type ProjectOptions
- type ProjectOptionsFn
- func WithConfig(config []string) ProjectOptionsFn
- func WithConfigFile(file string) ProjectOptionsFn
- func WithDefaultConfigPath() ProjectOptionsFn
- func WithDotConfig(enforce bool) ProjectOptionsFn
- func WithInterpolation(interpolation bool) ProjectOptionsFn
- func WithLogger(l log.Logger) ProjectOptionsFn
- func WithName(name string) ProjectOptionsFn
- func WithNormalization(normalization bool) ProjectOptionsFn
- func WithPackageManager(pm *packmanager.PackageManager) ProjectOptionsFn
- func WithResolvedPaths(resolve bool) ProjectOptionsFn
- func WithWorkingDirectory(wd string) ProjectOptionsFn
- type Transformer
- type TransformerFunc
Constants ¶
const ( DefaultOutputDir = "build" DefaultConfigFile = ".config" )
Variables ¶
var DefaultFileNames = []string{
"kraft.yaml",
"kraft.yml",
"Kraftfile.yml",
"Kraftfile.yaml",
"Kraftfile",
}
DefaultFileNames defines the kraft file names for auto-discovery (in order of preference)
var Schema string
Schema is the kraft-spec JSON schema
Functions ¶
func IsWorkdirInitialized ¶
IsWorkdirInitialized provides a quick check to determine if whether one of the supported project files (Kraftfiles) is present within a provided working directory.
func Load ¶
func Load(details config.ConfigDetails, options ...func(*LoaderOptions)) (*app.ApplicationConfig, error)
Load reads a ConfigDetails and returns a fully loaded configuration
func LoadLibraries ¶
func LoadLibraries(source map[string]interface{}, opts *LoaderOptions) (map[string]lib.LibraryConfig, error)
LoadLibraries produces a LibraryConfig map from a kraft file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func LoadTargets ¶
func LoadTargets(source []interface{}, configDetails config.ConfigDetails, outdir string, opts *LoaderOptions) ([]target.TargetConfig, error)
LoadTargets produces a LibraryConfig map from a kraft file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func LoadUnikraft ¶
func LoadUnikraft(source interface{}, opts *LoaderOptions) (core.UnikraftConfig, error)
LoadUnikraft produces a UnikraftConfig from a kraft file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func NewApplicationFromOptions ¶
func NewApplicationFromOptions(popts *ProjectOptions, copts ...component.ComponentOption) (*app.ApplicationConfig, error)
NewApplicationFromOptions load a kraft project based on command line options
func ParseYAML ¶
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 WithSkipValidation ¶
func WithSkipValidation(opts *LoaderOptions)
WithSkipValidation sets the LoaderOptions to skip validation when loading sections
Types ¶
type LoaderOptions ¶
type LoaderOptions struct { // Skip schema validation SkipValidation bool // Skip interpolation SkipInterpolation bool // Skip normalization SkipNormalization bool // Resolve paths ResolvePaths bool // Interpolation options Interpolate *interp.Options // PackageManager can be injected to each component to allow easy retrieval of // the component itself with regard to its source files as well as Unikraft's PackageManager *packmanager.PackageManager // contains filtered or unexported fields }
LoaderOptions supported by Load
func (LoaderOptions) GetProjectName ¶
func (o LoaderOptions) GetProjectName() (string, bool)
func (*LoaderOptions) SetProjectName ¶
func (o *LoaderOptions) SetProjectName(name string, imperativelySet bool)
type ProjectOptions ¶
type ProjectOptions struct { Name string WorkingDir string ConfigPaths []string Configuration kconfig.KConfigValues DotConfigFile 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 WithConfig ¶
func WithConfig(config []string) ProjectOptionsFn
WithConfig defines a key=value set of variables used for kraft file interpolation as well as with Unikraft's build system
func WithConfigFile ¶
func WithConfigFile(file string) ProjectOptionsFn
WithConfigFile set an alternate config file
func WithDefaultConfigPath ¶
func WithDefaultConfigPath() ProjectOptionsFn
WithDefaultConfigPath searches for default config files from working directory
func WithDotConfig ¶
func WithDotConfig(enforce bool) ProjectOptionsFn
WithDotConfig imports configuration variables from .config file
func WithInterpolation ¶
func WithInterpolation(interpolation bool) ProjectOptionsFn
WithInterpolation set ProjectOptions to enable/skip interpolation
func WithNormalization ¶
func WithNormalization(normalization bool) ProjectOptionsFn
WithNormalization set ProjectOptions to enable/skip normalization
func WithPackageManager ¶
func WithPackageManager(pm *packmanager.PackageManager) ProjectOptionsFn
WithPackageManager provides access to the package manager of choice to be able to retrieve component sources
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
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