config

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ADDR                  = "127.0.0.1:8050"
	DEFAULT_DATASOURCE_URL        = "mongodb://localhost:27017"
	DEFAULT_DB                    = "etre_dev"
	DEFAULT_DB_TIMEOUT            = 5000
	DEFAULT_CDC_COLLECTION        = "" // disabled
	DEFAULT_CDC_DELAY_COLLECTION  = "cdc_delay"
	DEFAULT_CDC_WRITE_RETRY_COUNT = 3
	DEFAULT_CDC_WRITE_RETRY_WAIT  = 50
	DEFAULT_CDC_FALLBACK_FILE     = "/tmp/etre-cdc.json"
	DEFAULT_CDC_STATIC_DELAY      = -1 // if negative, system will use a dynamic delayer
	DEFAULT_FEED_BUFFER_SIZE      = 100
	DEFAULT_FEED_POLL_INTERVAL    = 2000
	DEFAULT_ENTITY_TYPE           = "host"
	DEFAULT_QUERY_LATENCY_SLA     = "1s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Name              string   `yaml:"name"`
	Admin             bool     `yaml:"admin"`
	Read              []string `yaml:"read"`
	Write             []string `yaml:"write"`
	TraceKeysRequired []string `yaml:"trace_keys_required"`
}

type ACLConfig

type ACLConfig struct {
	Roles []ACL `yaml:"roles"`
}

type CDCConfig

type CDCConfig struct {
	// The collection that CDC events are stored in.
	Collection string `yaml:"collection"`
	// If set, CDC events will attempt to be written to this file if they cannot
	// be written to mongo.
	FallbackFile string `yaml:"fallback_file"`
	// Number of times CDC events will retry writing to mongo in the event of an error.
	WriteRetryCount int `yaml:"write_retry_count"`
	// Wait time in milliseconds between write retry events.
	WriteRetryWait int `yaml:"write_retry_wait"` // milliseconds
	// The collection that delays are stored in.
	DelayCollection string `yaml:"delay_collection"`
	// If this value is positive, the delayer will always return a max timestamp
	// that is time.Now() minus this config value. If this value is negative,
	// the delayer will return a max timestamp that dynamically changes
	// depending on the active API calls into Etre. Units in milliseconds.
	StaticDelay int `yaml:"static_delay"`
}

type Config

type Config struct {
	Server     ServerConfig     `yaml:"server"`
	Datasource DatasourceConfig `yaml:"datasource"`
	Entity     EntityConfig     `yaml:"entity"`
	CDC        CDCConfig        `yaml:"cdc"`
	Feed       FeedConfig       `yaml:"feed"`
	ACL        ACLConfig        `yaml:"acl"`
	Metrics    MetricsConfig    `yaml:"metrics"`
}

func Default

func Default() Config

func Load

func Load(file string) (Config, error)

type DatasourceConfig

type DatasourceConfig struct {
	URL      string `yaml:"url"`
	Database string `yaml:"database"`
	Timeout  int    `yaml:"timeout"`

	// Certs
	TLSCert string `yaml:"tls_cert"`
	TLSKey  string `yaml:"tls_key"`
	TLSCA   string `yaml:"tls_ca"`

	// Credentials
	Username  string `yaml:"username"`
	Source    string `yaml:"source"`
	Mechanism string `yaml:"mechanism"`
}

type EntityConfig

type EntityConfig struct {
	Types []string `yaml:"types"`
}

type FeedConfig

type FeedConfig struct {
	// The buffer size that a streamer has when consuming from the poller. If the
	// poller fills the buffer up then the streamer will error out since it won't
	// be able to catch up to the poller anymore.
	StreamerBufferSize int `yaml:"streamer_buffer_size"`
	// The amount of time that the poller will sleep between polls, in milliseconds.
	PollInterval int `yaml:"poll_interval"`
}

type MetricsConfig

type MetricsConfig struct {
	QueryLatencySLA string `yaml:"query_latency_sla"` // duration string
}

type ServerConfig

type ServerConfig struct {
	Addr    string `yaml:"addr"`
	TLSCert string `yaml:"tls_cert"`
	TLSKey  string `yaml:"tls_key"`
	TLSCA   string `yaml:"tls_ca"`

	// If client does not set X-Etre-Version, default to this version.
	DefaultClientVersion string `yaml:"default_client_version"`
}

Jump to

Keyboard shortcuts

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