config

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: BSD-2-Clause Imports: 18 Imported by: 25

Documentation

Overview

************************************************************************

  • Copyright 2017 Gravwell, Inc. All rights reserved.
  • Contact: <legal@gravwell.io> *
  • This software may be modified and distributed under the terms of the
  • BSD 2-clause license. See the LICENSE file for details. *************************************************************************

Index

Constants

View Source
const (
	DefaultCleartextPort uint16 = 4023
	DefaultTLSPort       uint16 = 4024
)

Variables

View Source
var (
	ErrNoConnections              = errors.New("No connections specified")
	ErrMissingIngestSecret        = errors.New("Ingest-Secret value missing")
	ErrInvalidLogLevel            = errors.New("Invalid Log Level")
	ErrInvalidConnectionTimeout   = errors.New("Invalid connection timeout")
	ErrInvalidIngestCacheSize     = errors.New("Invalid Max Ingest Cache size")
	ErrCacheEnabledZeroMax        = errors.New("Ingest cache enabled with zero Max Cache size")
	ErrGlobalSectionNotFound      = errors.New("Global config section not found")
	ErrInvalidLineLocation        = errors.New("Invalid line location")
	ErrInvalidUpdateLineParameter = errors.New("Update line location does not contain the specified paramter")
)
View Source
var (
	ErrInvalidArg   = errors.New("Invalid arguments")
	ErrEmptyEnvFile = errors.New("Environment secret file is empty")
)
View Source
var (
	ErrConfigFileTooLarge     = errors.New("Config file is too large")
	ErrFailedFileRead         = errors.New("Failed to read entire config file")
	ErrConfigNotOpen          = errors.New("Configuration is not open")
	ErrInvalidImportInterface = errors.New("Invalid import interface argument")
	ErrInvalidImportParameter = errors.New("parameter is not a pointer")
	ErrInvalidArgument        = errors.New("Invalid argument")
	ErrInvalidMapKeyType      = errors.New("invalid map key type, must be string")
	ErrInvalidMapValueType    = errors.New("invalid map value type, must be pointer to struct")
	ErrBadMap                 = errors.New("VariableConfig has not be initialized")
)

Functions

func AppendDefaultPort

func AppendDefaultPort(bstr string, defPort uint16) string

func LoadConfigBytes added in v3.2.5

func LoadConfigBytes(v interface{}, b []byte) error

func LoadConfigFile added in v3.2.5

func LoadConfigFile(v interface{}, p string) (err error)

LoadConfigFile will open a config file, check the file size and load the bytes using LoadBytesConfig

func LoadEnvVar

func LoadEnvVar(cnd interface{}, envName string, defVal interface{}) error

Attempts to read a value from environment variable named envName If there's nothing there, it attempt to append _FILE to the variable name and see if it contains a filename; if so, it reads the contents of the file into cnd.

func ParseBool added in v3.3.4

func ParseBool(v string) (r bool, err error)

func ParseInt64 added in v3.3.4

func ParseInt64(v string) (i int64, err error)

func ParseRate added in v3.3.4

func ParseRate(s string) (Bps int64, err error)

we return the rate in bytes per second

func ParseSource

func ParseSource(v string) (b net.IP, err error)

ParseSource returns a net.IP byte buffer the returned buffer will always be a 32bit or 128bit buffer but we accept encodings as IPv4, IPv6, integer, hex encoded hash this function simply walks the available encodings until one works

func ParseUint64 added in v3.3.4

func ParseUint64(v string) (i uint64, err error)

Types

type IngestConfig

type IngestConfig struct {
	Ingest_Secret              string
	Connection_Timeout         string
	Verify_Remote_Certificates bool //legacy, will be removed
	Insecure_Skip_TLS_Verify   bool
	Cleartext_Backend_Target   []string
	Encrypted_Backend_Target   []string
	Pipe_Backend_Target        []string
	Ingest_Cache_Path          string
	Max_Ingest_Cache           int64 //maximum amount of data to cache in MB
	Log_Level                  string
	Log_File                   string
	Source_Override            string // override normal source if desired
	Rate_Limit                 string
	Ingester_UUID              string
}

func (*IngestConfig) EnableCache

func (ic *IngestConfig) EnableCache() bool

EnableCache indicates whether a file cache is enabled

func (*IngestConfig) IngesterUUID added in v3.2.4

func (ic *IngestConfig) IngesterUUID() (id uuid.UUID, ok bool)

func (*IngestConfig) InsecureSkipTLSVerification

func (ic *IngestConfig) InsecureSkipTLSVerification() bool

func (*IngestConfig) LocalFileCachePath

func (ic *IngestConfig) LocalFileCachePath() string

LocalFileCachePath returns the path to the local ingest cache an empty string means no cache enabled

func (*IngestConfig) LogLevel

func (ic *IngestConfig) LogLevel() string

Return the specified log level

func (*IngestConfig) MaxCachedData

func (ic *IngestConfig) MaxCachedData() uint64

MaxCachedData returns the maximum amount of data to be cached in bytes

func (*IngestConfig) RateLimit

func (ic *IngestConfig) RateLimit() (bps int64, err error)

func (*IngestConfig) Secret

func (ic *IngestConfig) Secret() string

func (*IngestConfig) SetIngesterUUID added in v3.2.4

func (ic *IngestConfig) SetIngesterUUID(id uuid.UUID, loc string) (err error)

func (*IngestConfig) Targets

func (ic *IngestConfig) Targets() ([]string, error)

func (*IngestConfig) Timeout

func (ic *IngestConfig) Timeout() time.Duration

func (*IngestConfig) Verify

func (ic *IngestConfig) Verify() error

type VariableConfig added in v3.2.5

type VariableConfig struct {
	gcfg.Idxer
	Vals map[gcfg.Idx]*[]string
}

func (VariableConfig) MapTo added in v3.2.5

func (vc VariableConfig) MapTo(v interface{}) (err error)

Jump to

Keyboard shortcuts

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