configuration

package
v0.12.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package configuration provides support for loading individual Compose YAML files that contain x-mutagen attributes and generating Compose YAML files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// Version is the configuration file schema version.
	Version string
	// Services are the services defined in the file.
	Services map[string]struct{}
	// Volumes are the volumes defined in the file.
	Volumes map[string]struct{}
	// Networks are the networks defined in the file.
	Networks map[string]struct{}
	// Mutagen is the Mutagen session configuration found in the file. The
	// session specifications in this field are not validated by Load.
	Mutagen MutagenConfiguration
}

Configuration represents a single Docker Compose configuration file with Mutagen sessions specified using an "x-mutagen" extension.

func Load

func Load(path string, variables map[string]string) (*Configuration, error)

Load reads, interpolates, and decodes a Docker Compose YAML configuration from the specified file. If the file contains multiple YAML documents, then only the first will be read. Interpolation is performed using the specified variable mapping. The only validation performed by this function is on the YAML syntax and the keys and value types provided as part of the "x-mutagen" configuration. No validation is performed on Docker Compose fields or Mutagen session specifications.

type ForwardingConfiguration

type ForwardingConfiguration struct {
	// Source is the source URL for the session.
	Source string `yaml:"source"`
	// Destination is the destination URL for the session.
	Destination string `yaml:"destination"`
	// Configuration is the configuration for the session.
	Configuration forwarding.Configuration `yaml:",inline"`
	// ConfigurationSource is the source-specific configuration for the session.
	ConfigurationSource forwarding.Configuration `yaml:"configurationSource"`
	// ConfigurationDestination is the destination-specific configuration for
	// the session.
	ConfigurationDestination forwarding.Configuration `yaml:"configurationDestination"`
}

ForwardingConfiguration encodes a forwarding session specification.

type GeneratedComposeConfiguration

type GeneratedComposeConfiguration struct {
	// Version is the Docker Compose configuration file version.
	Version string `yaml:"version"`
	// Services are the Docker Compose services.
	Services map[string]*GeneratedServiceConfiguration `yaml:"services"`
}

GeneratedComposeConfiguration encodes a subset of the Docker Compose configuration format. It is only used for generating configuration files and thus only encodes those fields needed by Mutagen services. It is designed to be compatible with both 2.x and 3.x Docker Compose configuration formats.

func (*GeneratedComposeConfiguration) Store

Store encodes the configuration to YAML and writes it to a file at the specified path. The file is created with user-only permissions and must not already exist. The output file may be created even in the case of failure (for example if an error occurs during YAML encoding).

type GeneratedServiceConfiguration

type GeneratedServiceConfiguration struct {
	// Image is the image for the service.
	Image string `yaml:"image"`
	// Networks are the network dependencies for the service.
	Networks []string `yaml:"networks,omitempty"`
	// Volumes are the volume dependencies for the service.
	Volumes []string `yaml:"volumes,omitempty"`
}

GeneratedServiceConfiguration encodes a subset of the Docker Compose service configuration format. It is only used for generating Docker Compose service configurations, and thus only encodes those fields needed by generated Mutagen services. It is designed to be compatible with both 2.x and 3.x Docker Compose formats.

type MutagenConfiguration

type MutagenConfiguration struct {
	// Forwarding represents the forwarding sessions to be created. If a
	// "defaults" key is present, it is treated as a template upon which other
	// configurations are layered, thus keeping syntactic compatibility with the
	// global Mutagen configuration file.
	Forwarding map[string]ForwardingConfiguration `yaml:"forward"`
	// Synchronization represents the forwarding sessions to be created. If a
	// "defaults" key is present, it is treated as a template upon which other
	// configurations are layered, thus keeping syntactic compatibility with the
	// global Mutagen configuration file.
	Synchronization map[string]SynchronizationConfiguration `yaml:"sync"`
}

MutagenConfiguration encodes collections of Mutagen forwarding and synchronization sessions found under an "x-mutagen" extension field.

type SynchronizationConfiguration

type SynchronizationConfiguration struct {
	// Alpha is the alpha URL for the session.
	Alpha string `yaml:"alpha"`
	// Beta is the beta URL for the session.
	Beta string `yaml:"beta"`
	// Configuration is the configuration for the session.
	Configuration synchronization.Configuration `yaml:",inline"`
	// ConfigurationAlpha is the alpha-specific configuration for the session.
	ConfigurationAlpha synchronization.Configuration `yaml:"configurationAlpha"`
	// ConfigurationBeta is the beta-specific configuration for the session.
	ConfigurationBeta synchronization.Configuration `yaml:"configurationBeta"`
}

SynchronizationConfiguration encodes a synchronization session specification.

Jump to

Keyboard shortcuts

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