conf

package
v5.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 12 Imported by: 7

README

conf

Why not call this thing config? Because you end up calling your variables something weird like cfg or conf.

It's better to have an abbreviated package name than abbreviated variables.

Documentation

Overview

Changing configuration fields or semantics? Make sure to update commands/help/files/config.go as well

  • (c) 2016-2018 Adobe. All rights reserved.

  • This file is licensed to you under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License. You may obtain a copy

  • of the License at http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software distributed under

  • the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS

  • OF ANY KIND, either express or implied. See the License for the specific language

  • governing permissions and limitations under the License.

  • (c) 2016-2018 Adobe. All rights reserved.

  • This file is licensed to you under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License. You may obtain a copy

  • of the License at http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software distributed under

  • the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS

  • OF ANY KIND, either express or implied. See the License for the specific language

  • governing permissions and limitations under the License.

  • (c) 2016-2018 Adobe. All rights reserved.

  • This file is licensed to you under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License. You may obtain a copy

  • of the License at http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software distributed under

  • the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS

  • OF ANY KIND, either express or implied. See the License for the specific language

  • governing permissions and limitations under the License.

Index

Constants

View Source
const (
	Topology_Inet   = "inet"
	Topology_Worker = "worker"
	Topology_Cron   = "cron"
)

Variables

This section is empty.

Functions

func ValidateRegion

func ValidateRegion(region *Region, validateRoleArn bool) error

Types

type AutoScalingGroup

type AutoScalingGroup struct {
	SecurityGroupEgress []SecurityGroupEgress `yaml:"security_group_egress"`
	SecretsExecName     string                `yaml:"secrets_exec_name"`
	SecretsExecArgs     []string              `yaml:"secrets_exec_args"`
}

type AvailabilityZone

type AvailabilityZone struct {
	Name     string `yaml:"name"`
	SubnetID string `yaml:"subnet_id"`
}

type BlackoutWindow

type BlackoutWindow struct {
	StartTime string `yaml:"start_time"`
	EndTime   string `yaml:"end_time"`
}

type Config

type Config struct {
	ServiceName    string `yaml:"service_name"`
	ServiceVersion string
	PorterVersion  string            `yaml:"porter_version"`
	Environments   []*Environment    `yaml:"environments"`
	Slack          Slack             `yaml:"slack"`
	Hooks          map[string][]Hook `yaml:"hooks"`

	HAProxyStatsUsername string
	HAProxyStatsPassword string
}

Config supports multi-container deployments

func GetAlteredConfig

func GetAlteredConfig(log log15.Logger) (*Config, bool)

func GetConfig

func GetConfig(log log15.Logger, validate bool) (*Config, bool)

func GetHostConfig

func GetHostConfig(log log15.Logger) (*Config, bool)

func GetStdinConfig

func GetStdinConfig(log log15.Logger) (config *Config, success bool)

func (*Config) GetEnvironment

func (recv *Config) GetEnvironment(envName string) (*Environment, error)

func (*Config) Print

func (recv *Config) Print()

func (*Config) SetDefaults

func (recv *Config) SetDefaults()

Convention over configuration

func (*Config) Validate

func (recv *Config) Validate() (err error)

func (*Config) ValidateEnvironments

func (recv *Config) ValidateEnvironments() error

func (*Config) ValidateHooks

func (recv *Config) ValidateHooks() (err error)

func (*Config) ValidateRegistryConfig

func (recv *Config) ValidateRegistryConfig() error

func (*Config) ValidateTopLevelKeys

func (recv *Config) ValidateTopLevelKeys() error

type Container

type Container struct {
	Name                   string `yaml:"name"`
	OriginalName           string
	Topology               string       `yaml:"topology"`
	InetPort               int          `yaml:"inet_port"`
	Uid                    *int         `yaml:"uid"`
	ReadOnly               *bool        `yaml:"read_only"`
	Dockerfile             string       `yaml:"dockerfile"`
	DockerfileBuild        string       `yaml:"dockerfile_build"`
	ValidateBuildArgsExist *bool        `yaml:"validate_build_args_exist"`
	HealthCheck            *HealthCheck `yaml:"health_check"`
	SrcEnvFile             *SrcEnvFile  `yaml:"src_env_file"`
	PidsLimit              int          `yaml:"pids_limit"`
}

type ELB

type ELB struct {
	ELBTag string `yaml:"tag"`
	Name   string `yaml:"name"`
}

type Environment

type Environment struct {
	Name                string           `yaml:"name"`
	StackDefinitionPath string           `yaml:"stack_definition_path"`
	RoleARN             string           `yaml:"role_arn"`
	Hotswap             bool             `yaml:"hot_swap"`
	InstanceCount       uint             `yaml:"instance_count"`
	InstanceType        string           `yaml:"instance_type"`
	BlackoutWindows     []BlackoutWindow `yaml:"blackout_windows"`
	Regions             []*Region        `yaml:"regions"`

	HAProxy HAProxy `yaml:"haproxy"`

	// From the client's perspective this relates to SG creation and ELB
	// inspection that allows the 2 ELBs to communicate with EC2 instances.
	// From porter's perspective this is just a signal to create them so
	// further transformations can happen
	CreateSecurityGroups *bool `yaml:"autowire_security_groups"`
}

func (*Environment) GetELBForRegion

func (recv *Environment) GetELBForRegion(reg string, elbTag string) (string, error)

func (*Environment) GetInstanceCount

func (recv *Environment) GetInstanceCount(regionName string) (uint, error)

func (*Environment) GetRegion

func (recv *Environment) GetRegion(regionName string) (*Region, error)

func (*Environment) GetRoleARN

func (recv *Environment) GetRoleARN(regionName string) (string, error)

func (*Environment) GetStackDefinitionPath

func (recv *Environment) GetStackDefinitionPath(regionName string) (string, error)

func (*Environment) IsWithinBlackoutWindow

func (recv *Environment) IsWithinBlackoutWindow() error

type HAProxy

type HAProxy struct {
	// Capture headers for logging
	ReqHeaderCaptures []HeaderCapture `yaml:"request_header_captures"`
	ResHeaderCaptures []HeaderCapture `yaml:"response_header_captures"`
	Log               *bool           `yaml:"log"`
	Compression       bool            `yaml:"compression"`
	CompressTypes     []string        `yaml:"compress_types"`
	SSL               SSL             `yaml:"ssl"`
	Timeout           Timeout         `yaml:"timeout"`
	MaxConn           uint64          `yaml:"maxconn"`
}

func (HAProxy) UsingSSL

func (recv HAProxy) UsingSSL() bool

type HeaderCapture

type HeaderCapture struct {
	Header string `yaml:"header"`
	Length int    `yaml:"length"`
}

type HealthCheck

type HealthCheck struct {
	Method string `yaml:"method"`
	Path   string `yaml:"path"`
}

type Hook

type Hook struct {
	Repo         string            `yaml:"repo"`
	Ref          string            `yaml:"ref"`
	Dockerfile   string            `yaml:"dockerfile"`
	Environment  map[string]string `yaml:"environment"`
	Concurrent   bool              `yaml:"concurrent"`
	RunCondition string            `yaml:"run_condition"`
}

type Pem

type Pem struct {
	SecretsExecName string   `yaml:"secrets_exec_name"`
	SecretsExecArgs []string `yaml:"secrets_exec_args"`
}

type Region

type Region struct {
	Name                string             `yaml:"name"`
	StackDefinitionPath string             `yaml:"stack_definition_path"`
	VpcId               string             `yaml:"vpc_id"`
	AZs                 []AvailabilityZone `yaml:"azs"`
	ELBs                []*ELB             `yaml:"elbs"`
	ELB                 string             `yaml:"elb"`
	RoleARN             string             `yaml:"role_arn"`
	AutoScalingGroup    AutoScalingGroup   `yaml:"auto_scaling_group"`
	SSLCertARN          string             `yaml:"ssl_cert_arn"`
	HostedZoneName      string             `yaml:"hosted_zone_name"`
	KeyPairName         string             `yaml:"key_pair_name"`
	S3Bucket            string             `yaml:"s3_bucket"`
	SSEKMSKeyId         *string            `yaml:"sse_kms_key_id"`
	Containers          []*Container       `yaml:"containers"`
	InstanceCount       uint               `yaml:"instance_count"`
}

func (*Region) HasELB

func (recv *Region) HasELB() bool

func (*Region) HealthCheckMethod

func (recv *Region) HealthCheckMethod() string

func (*Region) HealthCheckPath

func (recv *Region) HealthCheckPath() string

func (*Region) PrimaryTopology

func (recv *Region) PrimaryTopology() (dominant string)

inet is a superset of worker which are almost identical to cron

func (*Region) ValidateContainers

func (recv *Region) ValidateContainers() error

type SSL

type SSL struct {
	CertDirectory  string `yaml:"cert_directory"`
	CertPath       string
	HTTPS_Only     bool `yaml:"https_only"`
	HTTPS_Redirect bool `yaml:"https_redirect"`

	Pem *Pem `yaml:"pem"`
}

type SecurityGroupEgress

type SecurityGroupEgress struct {
	CidrIp                     string `yaml:"cidr_ip" json:"CidrIp,omitempty"`
	FromPort                   int    `yaml:"from_port" json:"FromPort"`
	IpProtocol                 string `yaml:"ip_protocol" json:"IpProtocol,omitempty"`
	DestinationSecurityGroupId string `yaml:"destination_security_group_id" json:"DestinationSecurityGroupId,omitempty"`
	ToPort                     int    `yaml:"to_port" json:"ToPort"`
}

type Slack

type Slack struct {
	PackSuccessHook      string `yaml:"pack_success_webhook_url"`
	PackFailureHook      string `yaml:"pack_failure_webhook_url"`
	ProvisionSuccessHook string `yaml:"provision_success_webhook_url"`
	ProvisionFailureHook string `yaml:"provision_failure_webhook_url"`
	PromoteSuccessHook   string `yaml:"promote_success_webhook_url"`
	PromoteFailureHook   string `yaml:"promote_failure_webhook_url"`
}

type SrcEnvFile

type SrcEnvFile struct {
	S3Key    string   `yaml:"s3_key"`
	S3Bucket string   `yaml:"s3_bucket"`
	S3Region string   `yaml:"s3_region"`
	ExecName string   `yaml:"exec_name"`
	ExecArgs []string `yaml:"exec_args"`
}

type Timeout

type Timeout struct {
	Client         *string `yaml:"client"`
	Client_        time.Duration
	Server         *string `yaml:"server"`
	Server_        time.Duration
	Tunnel         *string `yaml:"tunnel"`
	Tunnel_        time.Duration
	HttpRequest    *string `yaml:"http_request"`
	HttpRequest_   time.Duration
	HttpKeepAlive  *string `yaml:"http_keep_alive"`
	HttpKeepAlive_ time.Duration
}

Jump to

Keyboard shortcuts

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