config

package
v3.0.0-M6+incompatible Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config defines configuration structures

Index

Constants

View Source
const DefaultConsulPubMaxRoutines int = 500

DefaultConsulPubMaxRoutines is the default maximum number of parallel goroutines used to store keys/values in Consul

See consulutil package for more details

View Source
const DefaultHTTPAddress string = "0.0.0.0"

DefaultHTTPAddress is the default listening address for the HTTP REST API

View Source
const DefaultHTTPPort int = 8800

DefaultHTTPPort is the default port number for the HTTP REST API

View Source
const DefaultKeepOperationRemotePath = false

DefaultKeepOperationRemotePath is set to true by default in order to remove path created to store operation artifacts on nodes.

View Source
const DefaultPluginDir = "plugins"

DefaultPluginDir is the default path for the plugin directory

View Source
const DefaultServerGracefulShutdownTimeout = 5 * time.Minute

DefaultServerGracefulShutdownTimeout is the default timeout for a graceful shutdown of a Yorc server before exiting

View Source
const DefaultWfStepGracefulTerminationTimeout = 2 * time.Minute

DefaultWfStepGracefulTerminationTimeout is the default timeout for a graceful termination of a workflow step during concurrent workflow step failure

View Source
const DefaultWorkersNumber int = 3

DefaultWorkersNumber is the default number of workers in the Yorc server

Variables

This section is empty.

Functions

This section is empty.

Types

type Ansible

type Ansible struct {
	UseOpenSSH              bool             `mapstructure:"use_openssh"`
	DebugExec               bool             `mapstructure:"debug"`
	ConnectionRetries       int              `mapstructure:"connection_retries"`
	OperationRemoteBaseDir  string           `mapstructure:"operation_remote_base_dir"`
	KeepOperationRemotePath bool             `mapstructure:"keep_operation_remote_path"`
	HostedOperations        HostedOperations `mapstructure:"hosted_operations"`
}

Ansible configuration

type Configuration

type Configuration struct {
	Ansible                          Ansible               `mapstructure:"ansible"`
	PluginsDirectory                 string                `mapstructure:"plugins_directory"`
	WorkingDirectory                 string                `mapstructure:"working_directory"`
	WorkersNumber                    int                   `mapstructure:"workers_number"`
	ServerGracefulShutdownTimeout    time.Duration         `mapstructure:"server_graceful_shutdown_timeout"`
	HTTPPort                         int                   `mapstructure:"http_port"`
	HTTPAddress                      string                `mapstructure:"http_address"`
	KeyFile                          string                `mapstructure:"key_file"`
	CertFile                         string                `mapstructure:"cert_file"`
	ResourcesPrefix                  string                `mapstructure:"resources_prefix"`
	Consul                           Consul                `mapstructure:"consul"`
	Telemetry                        Telemetry             `mapstructure:"telemetry"`
	Infrastructures                  map[string]DynamicMap `mapstructure:"infrastructures"`
	Vault                            DynamicMap            `mapstructure:"vault"`
	WfStepGracefulTerminationTimeout time.Duration         `mapstructure:"wf_step_graceful_termination_timeout"`
}

Configuration holds config information filled by Cobra and Viper (see commands package for more information)

func (Configuration) GetConsulClient

func (cfg Configuration) GetConsulClient() (*api.Client, error)

GetConsulClient returns the Consul client singleton instance from a given Configuration

func (Configuration) GetNewConsulClient

func (cfg Configuration) GetNewConsulClient() (*api.Client, error)

GetNewConsulClient returns a Consul client instance from a given Configuration used for plugin, tests but no for server runtime needs For standard server runtime need, use the GetConsulClient which returns a singleton

type Consul

type Consul struct {
	Token          string `mapstructure:"token"`
	Datacenter     string `mapstructure:"datacenter"`
	Address        string `mapstructure:"address"`
	Key            string `mapstructure:"key_file"`
	Cert           string `mapstructure:"cert_file"`
	CA             string `mapstructure:"ca_cert"`
	CAPath         string `mapstructure:"ca_path"`
	SSL            bool   `mapstructure:"ssl"`
	SSLVerify      bool   `mapstructure:"ssl_verify"`
	PubMaxRoutines int    `mapstructure:"publisher_max_routines"`
}

Consul configuration

type DockerSandbox

type DockerSandbox struct {
	Image      string   `mapstructure:"image"`
	Command    []string `mapstructure:"command"`
	Entrypoint []string `mapstructure:"entrypoint"`
	Env        []string `mapstructure:"env"`
}

DockerSandbox holds the configuration for a docker sandbox

type DynamicMap

type DynamicMap map[string]interface{}

DynamicMap allows to store configuration parameters that are not known in advance. This is particularly useful when configuration parameters may be defined in a plugin such for infrastructures.

It has methods to automatically cast data to the desired type.

func (DynamicMap) Get

func (dm DynamicMap) Get(name string) interface{}

Get returns the raw value of a given configuration key

func (DynamicMap) GetBool

func (dm DynamicMap) GetBool(name string) bool

GetBool returns the value of the given key casted into a boolean. False is returned if not found.

func (DynamicMap) GetDuration

func (dm DynamicMap) GetDuration(name string) time.Duration

GetDuration returns the value of the given key casted into a Duration. A 0 duration is returned if not found.

func (DynamicMap) GetInt

func (dm DynamicMap) GetInt(name string) int

GetInt returns the value of the given key casted into an int. 0 is returned if not found.

func (DynamicMap) GetString

func (dm DynamicMap) GetString(name string) string

GetString returns the value of the given key casted into a string. An empty string is returned if not found.

func (DynamicMap) GetStringOrDefault

func (dm DynamicMap) GetStringOrDefault(name, defaultValue string) string

GetStringOrDefault returns the value of the given key casted into a string. The given default value is returned if not found or not a valid string.

func (DynamicMap) GetStringSlice

func (dm DynamicMap) GetStringSlice(name string) []string

GetStringSlice returns the value of the given key casted into a slice of string. If the corresponding raw value is a string, it is split on comas. A nil or empty slice is returned if not found.

func (DynamicMap) IsSet

func (dm DynamicMap) IsSet(name string) bool

IsSet checks if a given configuration key is defined

func (DynamicMap) Keys

func (dm DynamicMap) Keys() []string

Keys returns registered keys in the dynamic map

func (DynamicMap) Set

func (dm DynamicMap) Set(name string, value interface{})

Set sets a value for a given key

type HostedOperations

type HostedOperations struct {
	UnsandboxedOperationsAllowed bool           `mapstructure:"unsandboxed_operations_allowed"`
	DefaultSandbox               *DockerSandbox `mapstructure:"default_sandbox"`
}

HostedOperations holds the configuration for operations executed on the orechestrator host (eg. with an operation_host equals to ORECHESTRATOR)

func (HostedOperations) Format

func (ho HostedOperations) Format(s fmt.State, verb rune)

Format implements fmt.Formatter to provide a custom formatter.

type Telemetry

type Telemetry struct {
	StatsdAddress           string `mapstructure:"statsd_address"`
	StatsiteAddress         string `mapstructure:"statsite_address"`
	PrometheusEndpoint      bool   `mapstructure:"expose_prometheus_endpoint"`
	ServiceName             string `mapstructure:"service_name"`
	DisableHostName         bool   `mapstructure:"disable_hostname"`
	DisableGoRuntimeMetrics bool   `mapstructure:"disable_go_runtime_metrics"`
}

Telemetry holds the configuration for the telemetry service

type TemplateResolver

type TemplateResolver interface {
	// SetTemplatesFunctions allows to define custom template functions
	SetTemplatesFunctions(fm template.FuncMap)
	// ResolveValueWithTemplates resolves a template
	ResolveValueWithTemplates(key string, value interface{}) interface{}
}

TemplateResolver allows to resolve templates in DynamicMap

var DefaultConfigTemplateResolver TemplateResolver = &configTemplateResolver{}

DefaultConfigTemplateResolver is the default resolver for configuration templates

Jump to

Keyboard shortcuts

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