inputfile

package
v2.2.12 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

Inputfile parsing

This package deals with configuration files ('coco.yaml' if not otherwise specified) that are identified within the basepath.

All possible inputs for configuration files can be obtained by running

coco inspect values

Sample output: (Note: the output might differ due to modifications in the codebase)

dependencies: list of dependencies ([]string)
name: name of component or environment (string) REQUIRED
type: type of the configuration file (string, options:[environment,component]) REQUIRED
values: list of .yaml files relative to the config file without file ending ([]string)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllConfigTypes = map[ConfigType]bool{COMPONENT: true, ENVIRONMENT: true}

Functions

func FindAll

func FindAll(
	basepath, configFileName string, includeOr, includeAnd, exclude []string,
) (map[string]files.File, error)

Types

type Coco

type Coco struct {
	Type         ConfigType `yaml:"type" doc:"msg=type of the configuration file,req,o=environment,o=component"`
	Values       []string   `yaml:"values" doc:"msg=list relative paths to config files, req=for environments only"`
	Name         string     `yaml:"name" doc:"msg=name of component or environment,req"`
	Dependencies []string   `yaml:"dependencies" doc:"msg=list of components that this component depends on, req=for components only"`
}

Coco struct contains keys for both components and environments. Unused fields are set nil by the unmarshal function

func Load

func Load(file string) (Coco, error)

Receives a file path and reads the byte content into a Coco struct File should be a yaml containing at least a valid type key

func (*Coco) IsComponent

func (c *Coco) IsComponent() bool

func (*Coco) IsEnvironment

func (c *Coco) IsEnvironment() bool

type ConfigType

type ConfigType string

Types of config files. Needs to be maintained manually together with the corresponding check functions.

const (
	COMPONENT   ConfigType = "component"
	ENVIRONMENT ConfigType = "environment"
)

Jump to

Keyboard shortcuts

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