combustion

package module
v0.0.0-...-4c8e646 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2017 License: MIT Imports: 19 Imported by: 0

README

combustion Build Status

Documentation

Combustion files are a extension to container linux config specification, some extra functionalities.

Output

Output defines the filename of the output for the file, if empty or not present the file is not written to the disk.

Type

Type defines the format of the output, the supported options are: cloud-config, ignition or container-linux, by default container-linux is used.

Import

Import option allows you to import another config file, merging the imported file over the importing file.

The import key is a map, where the key is the path to the file to be imported, relative to the importing file, the value is another map used to replaced using the golang template system.

Given foo.yaml:

---
import:
  bar.yaml:
    world: World!

foo: bar
baz: qux

And the bar.yaml:

---
text: Hello {{.world}}
foo: qux

The result is:

---
text: Hello World!
foo: qux
baz: qux
Additional features

Additionally to the described features, a new schema is supported in storage.file.content.remote.url, the file schema. When combustion is executed the file, relative to the yaml, is resolved and included inline.

Given foo.yaml

---
storage:
  files:
    - path: foo.txt
      contents:
        remote:
          url: file:///foo.txt

And the foo.txt

Hello World!

The result is:

---
storage:
  files:
    - path: foo.txt
      contents:
        inline: Hello World!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileSystem billy.Filesystem = osfs.New("/")

FileSystem used in any file operation

Functions

func Append

func Append(oldConfig, newConfig types.Config) types.Config

Append appends newConfig to oldConfig and returns the result. Appending one config to another is accomplished by iterating over every field in the config structure, appending slices, recursively appending structs, and overwriting old values with new values for all other types.

Types

type Config

type Config struct {
	Imports map[string]Values `yaml:"import,omitempty"`
	Output  string            `yaml:"output,omitempty"`
	Type    string            `yaml:"type,omitempty"`
	types.Config
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(r io.Reader, filename string, values map[string]string) (*Config, error)

NewConfig returns a new Config unmarshaling the r content interpolated with the given values. A dir, should be provided to be able to read and resolve all the includes

func NewConfigFromFile

func NewConfigFromFile(filename string, values map[string]string) (*Config, error)

NewConfigFromFile opens the given file and calls NewConfig with the given values

func (*Config) Render

func (c *Config) Render(w io.Writer) (r report.Report, err error)

func (*Config) SaveTo

func (c *Config) SaveTo(dir string) (report.Report, error)

func (*Config) Unmarshal

func (c *Config) Unmarshal(r io.Reader, values map[string]string) error

Unmarshal unmarshal the r content into Config, the content is interpolated using the given values

type ErrCircularDependency

type ErrCircularDependency struct {
	Stack stack
	File  string
}

func (*ErrCircularDependency) Error

func (err *ErrCircularDependency) Error() string

type Values

type Values map[string]string

Values interpolation values to replace on the Config

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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