unitconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2014 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigGlobals

type ConfigGlobals struct {
	SkipPush bool
	CfgUn    string
	CfgPass  string
	CfgEmail string
}

ConfigGlobals are the global values that may be set with SetGlobals

type ContainerSection

type ContainerSection struct {
	Name       string   `toml:"name" json:"name" yaml:"name"`
	Dockerfile string   `toml:"Dockerfile" json:"Dockerfile" yaml:"Dockerfile"`
	Registry   string   `toml:"registry" json:"registry" yaml:"registry"`
	Project    string   `toml:"project" json:"project" yaml:"project"`
	Tags       []string `toml:"tags" json:"tags" yaml:"tags"`
	SkipPush   bool     `toml:"skip_push" json:"skip_push" yaml:"skip_push"`
	CfgUn      string   `toml:"dockercfg_un" json:"dockercfg_un" yaml:"dockercfg_un"`
	CfgPass    string   `toml:"dockercfg_pass" json:"dockercfg_pass" yaml:"dockercfg_pass"`
	CfgEmail   string   `toml:"dockercfg_email" json:"dockercfg_email" yaml:"dockercfg_email"`
}

ContainerSection is a struct representation of an individual member of the "containers" section of a Builderfile. Each of these sections defines a docker container to be built and other related options.

type Docker

type Docker struct {
	BuildOpts []string `toml:"build_opts" json:"build_opts" yaml:"build_opts"`
	TagOpts   []string `toml:"tag_opts" json:"tag_opts" yaml:"tag_opts"`
}

Docker is a struct representation of the "docker" section of a Builderfile.

type Encoding

type Encoding int

Encoding is a constant that represents the config format of a file that is expected to contain an encoded unit-config

const (
	// TOML is for files encoded with TOML (or ending in .toml)
	TOML Encoding = iota

	// JSON is for files encoded in JSON (or ending in .json)
	JSON

	// YAML is for files encoded in YAML (or ending in .yml or .yaml)
	YAML
)

type UnitConfig

type UnitConfig struct {
	Version          int                 `toml:"version" json:"version" yaml:"version"`
	Docker           Docker              `toml:"docker" json:"docker" yaml:"docker"`
	ContainerArr     []*ContainerSection `toml:"container" json:"container" yaml:"container"`
	ContainerGlobals *ContainerSection   `toml:"container_globals" json:"container_globals" yaml:"container_globals"`
}

UnitConfig is a struct representation of what is expected to be inside a Builderfile for a single build/tag/push sequence.

func ReadFromFile

func ReadFromFile(path string, encodings ...Encoding) (*UnitConfig, error)

ReadFromFile accepts an unsanitized path to a Bobfile and returns the decoded UnitConfig. The value of encodings is a list of possible file encodings. If none is provided, the encoding will be inferred from the file extension as described in the documentation for the UnitConfigEncoding constants. If no encoding can be inferred, TOML will be used as the default.

func (*UnitConfig) SetGlobals

func (config *UnitConfig) SetGlobals(globals ConfigGlobals)

SetGlobals allows some global values to be set (i.e. if pulled from the env in the calling process)

Jump to

Keyboard shortcuts

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