types

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: MIT Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Name         string
	Description  string
	Version      string
	Dependencies []DependencyConfig
	Services     Services
	Templates    map[string]string `yaml:",omitempty"`
	Production   map[string]string `yaml:",omitempty"`
}

AppConfig represents the configuration of an application

func NewAppConfig

func NewAppConfig(appDir string) (result AppConfig, err error)

NewAppConfig reads application.yml and returns the appConfig object

func (AppConfig) GetDependencyNames

func (a AppConfig) GetDependencyNames() []string

GetDependencyNames returns the names of all dependencies listed in appConfig

func (AppConfig) GetServiceData

func (a AppConfig) GetServiceData() map[string]ServiceData

GetServiceData returns the configurations data for the given services

func (AppConfig) GetServiceNames

func (a AppConfig) GetServiceNames() []string

GetServiceNames returns the service names for the given services

func (AppConfig) GetServiceProtectionLevels

func (a AppConfig) GetServiceProtectionLevels() map[string]string

GetServiceProtectionLevels returns a map containing service names to their protection level

func (AppConfig) GetSilencedDependencyNames

func (a AppConfig) GetSilencedDependencyNames() []string

GetSilencedDependencyNames returns the names of dependencies that are configured as silent

func (AppConfig) GetSilencedServiceNames

func (a AppConfig) GetSilencedServiceNames() []string

GetSilencedServiceNames returns the names of services that are configured as silent

func (AppConfig) ValidateProductionFields

func (a AppConfig) ValidateProductionFields() error

ValidateProductionFields validates that service.yml contiains a production field and the required fields

func (AppConfig) VerifyServiceDoesNotExist

func (a AppConfig) VerifyServiceDoesNotExist(serviceRole string) error

VerifyServiceDoesNotExist returns an error if the service serviceRole already exists in existingServices, and return nil otherwise.

type AwsConfig

type AwsConfig struct {
	Region               string
	AccountID            string
	SslCertificateArn    string
	Profile              string
	CredentialsFile      string
	SecretsBucket        string
	TerraformStateBucket string
	TerraformLockTable   string
}

AwsConfig contains top level information about an application's AWS account

type DependencyConfig

type DependencyConfig struct {
	Config  DependencyConfigOptions `yaml:",omitempty"`
	Silent  bool                    `yaml:",omitempty"`
	Name    string
	Version string
}

DependencyConfig represents a dependency of an application

type DependencyConfigOptions

type DependencyConfigOptions struct {
	Ports                 []string          `yaml:",omitempty"`
	Volumes               []string          `yaml:",omitempty"`
	OnlineText            string            `yaml:"online-text,omitempty"`
	DependencyEnvironment map[string]string `yaml:"dependency-environment,omitempty"`
	ServiceEnvironment    map[string]string `yaml:"service-environment,omitempty"`
	ExternalInProduction  bool              `yaml:"external-in-production,omitempty"`
}

DependencyConfigOptions represents the configuration of a dependency

func (*DependencyConfigOptions) IsEmpty

func (d *DependencyConfigOptions) IsEmpty() bool

IsEmpty returns true if the given dependencyConfig object is empty

type DeployConfig

type DeployConfig struct {
	AppConfig                AppConfig
	ServiceConfigs           map[string]ServiceConfig
	LogChannel               chan string
	AppDir                   string
	HomeDir                  string
	DockerComposeProjectName string
	TerraformDir             string
	SecretsPath              string
	AwsConfig                AwsConfig
}

DeployConfig contains information needed for deployment

type DevelopmentConfig

type DevelopmentConfig struct {
	Scripts map[string]string `yaml:",omitempty"`
}

DevelopmentConfig is the development key listed in a ServiceConfig

type DockerCompose

type DockerCompose struct {
	Version  string
	Services DockerConfigs
}

DockerCompose represents the docker compose object

type DockerConfig

type DockerConfig struct {
	Image         string            `yaml:",omitempty"`
	Build         map[string]string `yaml:",omitempty"`
	Command       string            `yaml:",omitempty"`
	ContainerName string            `yaml:"container_name,omitempty"`
	Ports         []string          `yaml:",omitempty"`
	Volumes       []string          `yaml:",omitempty"`
	Links         []string          `yaml:",omitempty"`
	Environment   map[string]string `yaml:",omitempty"`
	DependsOn     []string          `yaml:"depends_on,omitempty"`
}

DockerConfig represents the configuration of a service/dependency as provided in docker-compose.yml

type DockerConfigs

type DockerConfigs map[string]DockerConfig

DockerConfigs represents a map of DockerConfig structs

func (DockerConfigs) Merge

func (d DockerConfigs) Merge(maps ...DockerConfigs) DockerConfigs

Merge joins the given docker config maps into one

type EnvVars

type EnvVars struct {
	Default     map[string]string `yaml:",omitempty"`
	Development map[string]string `yaml:",omitempty"`
	Production  map[string]string `yaml:",omitempty"`
	Secrets     []string          `yaml:",omitempty"`
}

EnvVars is the environment key listed in a ServiceConfig

type MessageTranslation

type MessageTranslation struct {
	Public   string `yaml:"public"`
	Internal string `yaml:"internal"`
}

MessageTranslation is the mapping from public to internal message names

type Secrets

type Secrets map[string]string

Secrets map contains maps from secret keys to values

func (Secrets) Delete

func (s Secrets) Delete(toDelete []string) Secrets

Delete deletes secrets from s. Ignores them if they do not exist

func (Secrets) Keys

func (s Secrets) Keys() []string

Keys returns all the keys for a secrets map

type ServiceConfig

type ServiceConfig struct {
	Type            string                 `yaml:",omitempty"`
	Description     string                 `yaml:",omitempty"`
	Author          string                 `yaml:",omitempty"`
	Startup         map[string]string      `yaml:",omitempty"`
	Restart         map[string]interface{} `yaml:",omitempty"`
	ServiceMessages `yaml:"messages,omitempty"`
	Docker          DockerConfig       `yaml:",omitempty"`
	Dependencies    []DependencyConfig `yaml:",omitempty"`
	Environment     EnvVars            `yaml:",omitempty"`
	Development     DevelopmentConfig  `yaml:",omitempty"`
	Production      map[string]string  `yaml:",omitempty"`
}

ServiceConfig represents the configuration of a service as provided in service.yml

func (ServiceConfig) GetEnvVars

func (s ServiceConfig) GetEnvVars(environment string) (map[string]string, []string)

GetEnvVars compiles a service's environment variables It overwrites default variables with environemnt specific ones, returning a map of public env vars and a list of private env var keys

func (ServiceConfig) ValidateProductionFields

func (s ServiceConfig) ValidateProductionFields(serviceData, protectionLevel string) error

ValidateProductionFields validates that service.yml contiains a production field and the required fields

type ServiceData

type ServiceData struct {
	Location            string               `yaml:",omitempty"`
	DockerImage         string               `yaml:"docker-image,omitempty"`
	MessageTranslations []MessageTranslation `yaml:"message-translation,omitempty"`
	Silent              bool                 `yaml:",omitempty"`
}

ServiceData represents the service info as provided in application.yml

type ServiceMessages

type ServiceMessages struct {
	Receives []string
	Sends    []string
}

ServiceMessages represents the messages that the service sends and receives

type Services

type Services struct {
	Public  map[string]ServiceData
	Private map[string]ServiceData
	Worker  map[string]ServiceData
}

Services represents the mapping of protection level to services

type ShutdownConfig

type ShutdownConfig struct {
	CloseMessage string
	ErrorMessage string
}

ShutdownConfig represents the configuration to use when shutting down an application

Jump to

Keyboard shortcuts

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