Documentation ¶
Overview ¶
Package config defines configuration structures
Index ¶
- Constants
- type Ansible
- type Configuration
- type Consul
- type DynamicMap
- func (dm DynamicMap) Get(name string) interface{}
- func (dm DynamicMap) GetBool(name string) bool
- func (dm DynamicMap) GetDuration(name string) time.Duration
- func (dm DynamicMap) GetInt(name string) int
- func (dm DynamicMap) GetString(name string) string
- func (dm DynamicMap) GetStringOrDefault(name, defaultValue string) string
- func (dm DynamicMap) GetStringSlice(name string) []string
- func (dm DynamicMap) IsSet(name string) bool
- func (dm DynamicMap) Keys() []string
- func (dm DynamicMap) Set(name string, value interface{})
- type Telemetry
- type TemplateResolver
Constants ¶
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
const DefaultHTTPAddress string = "0.0.0.0"
DefaultHTTPAddress is the default listening address for the HTTP REST API
const DefaultHTTPPort int = 8800
DefaultHTTPPort is the default port number for the HTTP REST API
const DefaultKeepOperationRemotePath = false
DefaultKeepOperationRemotePath is set to true by default in order to remove path created to store operation artifacts on nodes.
const DefaultPluginDir = "plugins"
DefaultPluginDir is the default path for the plugin directory
const DefaultServerGracefulShutdownTimeout = 5 * time.Minute
DefaultServerGracefulShutdownTimeout is the default timeout for a graceful shutdown of a Yorc server before exiting
const DefaultWfStepGracefulTerminationTimeout = 2 * time.Minute
DefaultWfStepGracefulTerminationTimeout is the default timeout for a graceful termination of a workflow step during concurrent workflow step failure
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 DebugExec bool ConnectionRetries int OperationRemoteBaseDir string KeepOperationRemotePath bool }
Ansible configuration
type Configuration ¶
type Configuration struct { Ansible Ansible PluginsDirectory string WorkingDirectory string WorkersNumber int ServerGracefulShutdownTimeout time.Duration HTTPPort int HTTPAddress string KeyFile string CertFile string ResourcesPrefix string Consul Consul Telemetry Telemetry Infrastructures map[string]DynamicMap Vault DynamicMap WfStepGracefulTerminationTimeout time.Duration }
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 a Consul client from a given Configuration
type Consul ¶
type Consul struct { Token string Datacenter string Address string Key string Cert string CA string CAPath string SSL bool SSLVerify bool PubMaxRoutines int }
Consul configuration
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 Telemetry ¶
type Telemetry struct { StatsdAddress string StatsiteAddress string PrometheusEndpoint bool ServiceName string DisableHostName bool DisableGoRuntimeMetrics bool }
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