config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExists added in v0.0.3

func EnsureDirExists(dir string) error

EnsureDirExists creates the named directory if it does not exist.

Types

type Config

type Config struct {
	// StateLocation is either a file containing a pre-compiled state, or
	// a directory containing the state as a tree.
	StateLocation string `env:"SOUS_STATE_LOCATION"`
	// Server is the location of a Sous Server which this sous instance
	// considers the master. If this is not set, this node is considered
	// to be a master. This value must be in URL format.
	Server string `env:"SOUS_SERVER"`
	// Database contains configuration for the local Postgresql DB.
	Database storage.PostgresConfig
	// DatabasePrimary controls whether the PostgreSQL database is the primary
	// datastore, or the git repo at StateLocation is.
	// As of May 30, 2018, this is being added as a temporary feature flag. The
	// idea is to use it to transition to DB only and then change the behavior
	// to be (unconditionally) DatabasePrimary=true.
	DatabasePrimary bool `env:"SOUS_DATABASE_IS_PRIMARY"`
	// SiblingURLs is a temporary measure for setting up a distributed cluster
	// of sous servers. Each server must be configured with accessible URLs for
	// all the servers in production, as named by cluster.
	// (someday this should be replaced with a gossip protocol)
	SiblingURLs map[string]string `env:"SOUS_SIBLING_URLS"`
	// BuildStateDir is a directory where information about builds
	// performed by this user on this machine are stored.
	BuildStateDir string `env:"SOUS_BUILD_STATE_DIR"`
	// Docker is the Docker configuration.
	Docker docker.Config
	// Logging is the logging configuration.
	Logging logging.Config
	// User identifies the user of this client.
	User sous.User
	// MaxHTTPConcurrencySingularity is the maximum number of concurrent
	// requests that can be made to a single Singularity instance.
	MaxHTTPConcurrencySingularity int `env:"MAX_HTTP_CONCURRENCY_SINGULARITY"`
	// PollIntervalForClient is the maximum number of checks for client on SOUS Deploy
	PollIntervalForClient int `env:"SOUS_POLL_INTERVAL_FOR_CLIENT"`
	// SlackHookURL when set with SlackChannel will send messages to specified web hook
	SlackHookURL string `env:"SOUS_SLACK_HOOK_URL"`
	// SlackChannel that should receive messages
	SlackChannel string `env:"SOUS_SLACK_CHANNEL"`
	// AdditionalSlackChannels that should receive messages
	AdditionalSlackChannels map[string]string `env:"SOUS_ADDITIONAL_SLACK_CHANNELS"`
}

Config contains the core Sous configuration, shared by both the client and server. The client and server may additionally have their own configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration.

func (*Config) Equal added in v0.0.3

func (c *Config) Equal(other *Config) bool

Equal compares

func (*Config) FillDefaults

func (c *Config) FillDefaults() error

FillDefaults fills in default values in this Config where they are currently zero values.

func (Config) Validate added in v0.0.3

func (c Config) Validate() error

Validate returns an error if this config is invalid.

type DeployFilterFlags

type DeployFilterFlags struct {
	DeploymentIDFlags
	SourceVersionFlags
	All bool
}

DeployFilterFlags are CLI flags used to configure the underlying deployments a given command will refer to N.b. that not every command will use every filter

func MakeDeployFilterFlags added in v1.0.1

func MakeDeployFilterFlags(config func(*DeployFilterFlags)) DeployFilterFlags

MakeDeployFilterFlags encapsulates setting fields on a brand new DeployFilterFlags. It is more convenient to use this than to manually construct the hierarchical nested structs otherwise necessary.

func (*DeployFilterFlags) BuildFilter added in v0.0.3

func (f *DeployFilterFlags) BuildFilter(parseSL func(string) (sous.SourceLocation, error)) (*sous.ResolveFilter, error)

BuildFilter creates a ResolveFilter from DeployFilterFlags.

func (*DeployFilterFlags) BuildPredicate

func (f *DeployFilterFlags) BuildPredicate(parseSL func(string) (sous.SourceLocation, error)) (sous.DeploymentPredicate, error)

BuildPredicate returns a predicate used for filtering targeted deployments.

It returns an error if the combination of flags is invalid, or if parseSL returns an error parsing Source.

func (DeployFilterFlags) EachField added in v1.0.1

func (f DeployFilterFlags) EachField(fn func(logging.FieldName, interface{}))

EachField implements logging.EachFielder on DeployFilterFlags.

func (DeployFilterFlags) SourceIDFlags added in v1.0.1

func (f DeployFilterFlags) SourceIDFlags() SourceIDFlags

SourceIDFlags returns an equivalent SourceIDFlags.

type DeploymentIDFlags added in v1.0.1

type DeploymentIDFlags struct {
	ManifestIDFlags
	Cluster string
}

DeploymentIDFlags identify a Deployment.

func (DeploymentIDFlags) DeploymentID added in v1.0.1

func (f DeploymentIDFlags) DeploymentID() (sous.DeploymentID, error)

DeploymentID returns the sous.DeploymentID that these flags represent. If there is missing data from these flags, it returns a non-nil error.

type LocalUser added in v1.0.1

type LocalUser struct {
	*user.User
}

LocalUser represents the OS user running Sous.

func (*LocalUser) ConfigDir added in v1.0.1

func (u *LocalUser) ConfigDir() string

ConfigDir returns the directory we should use to store Sous configuration data

func (*LocalUser) ConfigFile added in v1.0.1

func (u *LocalUser) ConfigFile() string

ConfigFile returns the path to the local Sous config file

func (*LocalUser) DefaultConfig added in v1.0.1

func (u *LocalUser) DefaultConfig() Config

DefaultConfig builds a default configuration for this user

type ManifestIDFlags added in v1.0.1

type ManifestIDFlags struct {
	SourceLocationFlags
	Flavor string
}

ManifestIDFlags identify a manifest.

func (ManifestIDFlags) ManifestID added in v1.0.1

func (f ManifestIDFlags) ManifestID() sous.ManifestID

ManifestID returns the sous.ManifestID that these flags represent.

type OTPLFlags

type OTPLFlags struct {
	UseOTPLDeploy    bool `flag:"use-otpl-deploy"`
	IgnoreOTPLDeploy bool `flag:"ignore-otpl-deploy"`
	// Flavor is required when multiple flavors are present in otpl-deploy
	// config.
	Flavor string `flag:"flavor"`
}

OTPLFlags set options for sniffing otpl-deploy configuration during manifest initialisation.

type PolicyFlags

type PolicyFlags struct {
	ForceClone, Strict, Dev bool
}

PolicyFlags capture user intent about the processing of a build

type SourceIDFlags added in v1.0.1

type SourceIDFlags struct {
	SourceLocationFlags
	SourceVersionFlags
}

SourceIDFlags identify a version of a particular SourceLocation.

func NewSourceIDFlags added in v1.0.1

func NewSourceIDFlags(sid sous.SourceID) SourceIDFlags

NewSourceIDFlags returns a SourceIDFlags based on sid.

func (SourceIDFlags) DeployFilterFlags added in v1.0.1

func (f SourceIDFlags) DeployFilterFlags() DeployFilterFlags

DeployFilterFlags returns an equivalent DeployFilterFlags.

func (SourceIDFlags) SourceID added in v1.0.1

func (f SourceIDFlags) SourceID() (sous.SourceID, error)

SourceID returns the sous.SourceID represented by these flags.

type SourceLocationFlags added in v1.0.1

type SourceLocationFlags struct {
	Source string
	Repo   string
	Offset string
}

SourceLocationFlags identify a SourceLocation.

func (SourceLocationFlags) SourceLocation added in v1.0.1

func (f SourceLocationFlags) SourceLocation() sous.SourceLocation

SourceLocation returns the SourceLocation represented by these flags.

type SourceVersionFlags added in v1.0.1

type SourceVersionFlags struct {
	Tag      string
	Revision string
}

SourceVersionFlags are Tag and Revision.

type Verbosity

type Verbosity struct {
	Silent, Quiet, Loud, Debug bool
}

Verbosity configures how chatty Sous is on its logs

func (Verbosity) UpdateLevel added in v1.0.1

func (v Verbosity) UpdateLevel(set *logging.LogSet)

UpdateLevel updates the logging level of the provided LogSet to reflect this Verbosity

Jump to

Keyboard shortcuts

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