config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

copied from github.com/elastic/beats

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStrictPerms

func IsStrictPerms() bool

IsStrictPerms returns true if strict permission checking on config files is enabled.

func NewFlagOverwrite

func NewFlagOverwrite(
	set *flag.FlagSet,
	config *Config,
	name, path, def, usage string,
) *string

Types

type ClusterConfig

type ClusterConfig struct {
	Name  string `config:"name"`
	Seeds string `config:"seeds"`
}

type Config

type Config ucfg.Config

Config object to store hierarchical configurations into. See https://godoc.org/github.com/elastic/go-ucfg#Config

func LoadFile

func LoadFile(path string) (*Config, error)

func LoadFiles

func LoadFiles(paths ...string) (*Config, error)

func MergeConfigs

func MergeConfigs(cfgs ...*Config) (*Config, error)

func NewConfig

func NewConfig() *Config

func NewConfigFrom

func NewConfigFrom(from interface{}) (*Config, error)

func NewConfigWithYAML

func NewConfigWithYAML(in []byte, source string) (*Config, error)

func NewFlagConfig

func NewFlagConfig(
	set *flag.FlagSet,
	def *Config,
	name string,
	usage string,
) *Config

func (*Config) Bool

func (c *Config) Bool(name string, idx int) (bool, error)

func (*Config) Child

func (c *Config) Child(name string, idx int) (*Config, error)

func (*Config) CountField

func (c *Config) CountField(name string) (int, error)

func (*Config) Enabled

func (c *Config) Enabled() bool

func (*Config) Float

func (c *Config) Float(name string, idx int) (float64, error)

func (*Config) GetFields

func (c *Config) GetFields() []string

func (*Config) HasField

func (c *Config) HasField(name string) bool

func (*Config) Int

func (c *Config) Int(name string, idx int) (int64, error)

func (*Config) IsArray

func (c *Config) IsArray() bool

func (*Config) IsDict

func (c *Config) IsDict() bool

func (*Config) Merge

func (c *Config) Merge(from interface{}) error

func (*Config) Path

func (c *Config) Path() string

func (*Config) PathOf

func (c *Config) PathOf(field string) string

func (*Config) SetBool

func (c *Config) SetBool(name string, idx int, value bool) error

func (*Config) SetChild

func (c *Config) SetChild(name string, idx int, value *Config) error

func (*Config) SetFloat

func (c *Config) SetFloat(name string, idx int, value float64) error

func (*Config) SetInt

func (c *Config) SetInt(name string, idx int, value int64) error

func (*Config) SetString

func (c *Config) SetString(name string, idx int, value string) error

func (*Config) String

func (c *Config) String(name string, idx int) (string, error)

func (*Config) Unpack

func (c *Config) Unpack(to interface{}) error

type ConfigNamespace

type ConfigNamespace struct {
	C map[string]*Config `config:",inline"`
}

ConfigNamespace storing at most one configuration section by name and sub-section.

func (*ConfigNamespace) Config

func (ns *ConfigNamespace) Config() *Config

Config return the sub-configuration section if a section has been set.

func (*ConfigNamespace) IsSet

func (ns *ConfigNamespace) IsSet() bool

IsSet returns true if a sub-configuration section has been set.

func (*ConfigNamespace) Name

func (ns *ConfigNamespace) Name() string

Name returns the configuration sections it's name if a section has been set.

func (*ConfigNamespace) Validate

func (ns *ConfigNamespace) Validate() error

Validate checks at most one sub-namespace being set.

type LoggingConfig

type LoggingConfig struct {
	RealtimePushEnabled  bool   `json:"realtime"`
	LogLevel             string `json:"log_level"`
	PushLogLevel         string `json:"push_log_level"`
	FuncFilterPattern    string `json:"func_pattern"`
	FileFilterPattern    string `json:"file_pattern"`
	MessageFilterPattern string `json:"message_pattern"`
}

type MatchRule

type MatchRule struct {
	Contain    []string
	NotContain []string
	Prefix     []string
	Suffix     []string
}

type MustMatchRule

type MustMatchRule struct {
	*MatchRule
}

type MustNotMatchRule

type MustNotMatchRule struct {
	*MatchRule
}

type NetworkConfig

type NetworkConfig struct {
	Host string `config:"host"`
}

type NodeConfig

type NodeConfig struct {
	Name string `config:"name"`
}

type PathConfig

type PathConfig struct {
	Data string `config:"data"`
	Log  string `config:"logs"`
	Cert string `config:"certs"`
}

type RuntimeConfig

type RuntimeConfig struct {
	Modules []*Config `config:"modules"`
}

type ShouldMatchRule

type ShouldMatchRule struct {
	*MatchRule
}

type SystemConfig

type SystemConfig struct {
	ConfigFile string

	ClusterConfig ClusterConfig `config:"cluster"`

	NetworkConfig NetworkConfig `config:"network"`

	NodeConfig NodeConfig `config:"node"`

	PathConfig PathConfig `config:"path"`

	APIBinding     string `config:"api_bind"`
	HttpBinding    string `config:"http_bind"`
	ClusterBinding string `config:"cluster_bind"`

	AllowMultiInstance bool `config:"multi_instance"`
	TLSEnabled         bool `config:"tls_enabled"`
}

high priority config, init from the environment or startup, can't be changed on the fly, need to restart

func (*SystemConfig) GetDataDir

func (this *SystemConfig) GetDataDir() string

Jump to

Keyboard shortcuts

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