config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2016 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ValidRemotes list the of valid prefixes that can be sent to Docker as a build remote location
	// This is public for consumers of libcompose to use
	ValidRemotes = []string{
		"git://",
		"git@github.com:",
		"github.com",
		"http:",
		"https:",
	}
)

Functions

func GetServiceHash

func GetServiceHash(name string, config *ServiceConfig) string

GetServiceHash computes and returns a hash that will identify a service. This hash will be then used to detect if the service definition/configuration have changed and needs to be recreated.

func Interpolate

func Interpolate(environmentLookup EnvironmentLookup, config *RawServiceMap) error

Interpolate replaces variables in the raw map representation of the project file

func MergeServices

func MergeServices(existingServices *Configs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, bytes []byte) (map[string]*ServiceConfig, error)

MergeServices merges a compose file into an existing set of service configs

Types

type Configs

type Configs struct {
	// contains filtered or unexported fields
}

Configs holds a concurrent safe map of ServiceConfig

func NewConfigs

func NewConfigs() *Configs

NewConfigs initializes a new Configs struct

func (*Configs) Add

func (c *Configs) Add(name string, service *ServiceConfig)

Add add the specifed config with the specified name

func (*Configs) Get

func (c *Configs) Get(name string) (*ServiceConfig, bool)

Get returns the config and the presence of the specified name

func (*Configs) Has

func (c *Configs) Has(name string) bool

Has checks if the config map has the specified name

func (*Configs) Keys

func (c *Configs) Keys() []string

Keys returns the names of the config

func (*Configs) Len

func (c *Configs) Len() int

Len returns the len of the configs

type EnvironmentLookup

type EnvironmentLookup interface {
	Lookup(key, serviceName string, config *ServiceConfig) []string
}

EnvironmentLookup defines methods to provides environment variable loading.

type RawService

type RawService map[string]interface{}

RawService is represent a Service in map form unparsed

type RawServiceMap

type RawServiceMap map[string]RawService

RawServiceMap is a collection of RawServices

type ResourceLookup

type ResourceLookup interface {
	Lookup(file, relativeTo string) ([]byte, string, error)
	ResolvePath(path, inFile string) string
}

ResourceLookup defines methods to provides file loading.

type ServiceConfig

type ServiceConfig struct {
	Build         string               `yaml:"build,omitempty"`
	CapAdd        []string             `yaml:"cap_add,omitempty"`
	CapDrop       []string             `yaml:"cap_drop,omitempty"`
	CgroupParent  string               `yaml:"cgroup_parent,omitempty"`
	CPUQuota      int64                `yaml:"cpu_quota,omitempty"`
	CPUSet        string               `yaml:"cpuset,omitempty"`
	CPUShares     int64                `yaml:"cpu_shares,omitempty"`
	Command       yaml.Command         `yaml:"command,flow,omitempty"`
	ContainerName string               `yaml:"container_name,omitempty"`
	Devices       []string             `yaml:"devices,omitempty"`
	DNS           yaml.Stringorslice   `yaml:"dns,omitempty"`
	DNSSearch     yaml.Stringorslice   `yaml:"dns_search,omitempty"`
	Dockerfile    string               `yaml:"dockerfile,omitempty"`
	DomainName    string               `yaml:"domainname,omitempty"`
	Entrypoint    yaml.Command         `yaml:"entrypoint,flow,omitempty"`
	EnvFile       yaml.Stringorslice   `yaml:"env_file,omitempty"`
	Environment   yaml.MaporEqualSlice `yaml:"environment,omitempty"`
	Hostname      string               `yaml:"hostname,omitempty"`
	Image         string               `yaml:"image,omitempty"`
	Labels        yaml.SliceorMap      `yaml:"labels,omitempty"`
	Links         yaml.MaporColonSlice `yaml:"links,omitempty"`
	LogDriver     string               `yaml:"log_driver,omitempty"`
	MacAddress    string               `yaml:"mac_address,omitempty"`
	MemLimit      int64                `yaml:"mem_limit,omitempty"`
	MemSwapLimit  int64                `yaml:"memswap_limit,omitempty"`
	Name          string               `yaml:"name,omitempty"`
	Net           string               `yaml:"net,omitempty"`
	Pid           string               `yaml:"pid,omitempty"`
	Uts           string               `yaml:"uts,omitempty"`
	Ipc           string               `yaml:"ipc,omitempty"`
	Ports         []string             `yaml:"ports,omitempty"`
	Privileged    bool                 `yaml:"privileged,omitempty"`
	Restart       string               `yaml:"restart,omitempty"`
	ReadOnly      bool                 `yaml:"read_only,omitempty"`
	StdinOpen     bool                 `yaml:"stdin_open,omitempty"`
	SecurityOpt   []string             `yaml:"security_opt,omitempty"`
	Tty           bool                 `yaml:"tty,omitempty"`
	User          string               `yaml:"user,omitempty"`
	VolumeDriver  string               `yaml:"volume_driver,omitempty"`
	Volumes       []string             `yaml:"volumes,omitempty"`
	VolumesFrom   []string             `yaml:"volumes_from,omitempty"`
	WorkingDir    string               `yaml:"working_dir,omitempty"`
	Expose        []string             `yaml:"expose,omitempty"`
	ExternalLinks []string             `yaml:"external_links,omitempty"`
	LogOpt        map[string]string    `yaml:"log_opt,omitempty"`
	ExtraHosts    []string             `yaml:"extra_hosts,omitempty"`
	Ulimits       yaml.Ulimits         `yaml:"ulimits,omitempty"`
}

ServiceConfig holds libcompose service configuration

Jump to

Keyboard shortcuts

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