config

package
v0.0.0-...-98a7958 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TLSProfileKey          = "server.tls_compatibility"
	TLSProfileModern       = "modern"
	TLSProfileIntermediate = "intermediate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	TokenKeySize              int           `yaml:"token_key_size"`
	InviteTokenValidityPeriod time.Duration `yaml:"invite_token_validity_period"`
}

AppConfig defines configs related to HTTP

type AuthConfig

type AuthConfig struct {
	JwtKey      string `yaml:"jwt_key"`
	BcryptCost  int    `yaml:"bcrypt_cost"`
	SaltKeySize int    `yaml:"salt_key_size"`
}

AuthConfig defines configs related to user authorization

type FilesystemConfig

type FilesystemConfig struct {
	StatusLogFile        string `yaml:"status_log_file"`
	ResultLogFile        string `yaml:"result_log_file"`
	EnableLogRotation    bool   `yaml:"enable_log_rotation"`
	EnableLogCompression bool   `yaml:"enable_log_compression"`
}

FilesystemConfig defines configs for the Filesystem logging plugin

type FirehoseConfig

type FirehoseConfig struct {
	Region           string
	AccessKeyID      string `yaml:"access_key_id"`
	SecretAccessKey  string `yaml:"secret_access_key"`
	StsAssumeRoleArn string `yaml:"sts_assume_role_arn"`
	StatusStream     string `yaml:"status_stream"`
	ResultStream     string `yaml:"result_stream"`
}

FirehoseConfig defines configs for the AWS Firehose logging plugin

type KinesisConfig

type KinesisConfig struct {
	Region           string
	AccessKeyID      string `yaml:"access_key_id"`
	SecretAccessKey  string `yaml:"secret_access_key"`
	StsAssumeRoleArn string `yaml:"sts_assume_role_arn"`
	StatusStream     string `yaml:"status_stream"`
	ResultStream     string `yaml:"result_stream"`
}

KinesisConfig defines configs for the AWS Kinesis logging plugin

type KolideConfig

type KolideConfig struct {
	Mysql      MysqlConfig
	Redis      RedisConfig
	Server     ServerConfig
	Auth       AuthConfig
	App        AppConfig
	Session    SessionConfig
	Osquery    OsqueryConfig
	Logging    LoggingConfig
	Firehose   FirehoseConfig
	Kinesis    KinesisConfig
	PubSub     PubSubConfig
	Filesystem FilesystemConfig
}

KolideConfig stores the application configuration. Each subcategory is broken up into it's own struct, defined above. When editing any of these structs, Manager.addConfigs and Manager.LoadConfig should be updated to set and retrieve the configurations as appropriate.

func TestConfig

func TestConfig() KolideConfig

TestConfig returns a barebones configuration suitable for use in tests. Individual tests may want to override some of the values provided.

type LoggingConfig

type LoggingConfig struct {
	Debug         bool
	JSON          bool
	DisableBanner bool `yaml:"disable_banner"`
}

LoggingConfig defines configs related to logging

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages the addition and retrieval of config values for Fleet configs. It's only public API method is LoadConfig, which will return the populated KolideConfig struct.

func NewManager

func NewManager(command *cobra.Command) Manager

NewManager initializes a Manager wrapping the provided cobra command. All config flags will be attached to that command (and inherited by the subcommands). Typically this should be called just once, with the root command.

func (Manager) IsSet

func (man Manager) IsSet(key string) bool

IsSet determines whether a given config key has been explicitly set by any of the configuration sources. If false, the default value is being used.

func (Manager) LoadConfig

func (man Manager) LoadConfig() KolideConfig

LoadConfig will load the config variables into a fully initialized KolideConfig struct

type MysqlConfig

type MysqlConfig struct {
	Protocol        string
	Address         string
	Username        string
	Password        string
	Database        string
	TLSCert         string `yaml:"tls_cert"`
	TLSKey          string `yaml:"tls_key"`
	TLSCA           string `yaml:"tls_ca"`
	TLSServerName   string `yaml:"tls_server_name"`
	TLSConfig       string `yaml:"tls_config"` //tls=customValue in DSN
	MaxOpenConns    int    `yaml:"max_open_conns"`
	MaxIdleConns    int    `yaml:"max_idle_conns"`
	ConnMaxLifetime int    `yaml:"conn_max_lifetime"`
}

MysqlConfig defines configs related to MySQL

type OsqueryConfig

type OsqueryConfig struct {
	NodeKeySize          int           `yaml:"node_key_size"`
	StatusLogPlugin      string        `yaml:"status_log_plugin"`
	ResultLogPlugin      string        `yaml:"result_log_plugin"`
	LabelUpdateInterval  time.Duration `yaml:"label_update_interval"`
	DetailUpdateInterval time.Duration `yaml:"detail_update_interval"`
	StatusLogFile        string        `yaml:"status_log_file"`
	ResultLogFile        string        `yaml:"result_log_file"`
	EnableLogRotation    bool          `yaml:"enable_log_rotation"`
}

OsqueryConfig defines configs related to osquery

type PubSubConfig

type PubSubConfig struct {
	Project     string
	StatusTopic string `yaml:"status_topic"`
	ResultTopic string `yaml:"result_topic"`
}

PubSubConfig defines configs the for Google PubSub logging plugin

type RedisConfig

type RedisConfig struct {
	Address  string
	Password string
	Database int
	UseTLS   bool `yaml:"use_tls"`
}

RedisConfig defines configs related to Redis

type ServerConfig

type ServerConfig struct {
	Address    string
	Cert       string
	Key        string
	TLS        bool
	TLSProfile string
	URLPrefix  string `yaml:"url_prefix"`
}

ServerConfig defines configs related to the Fleet server

type SessionConfig

type SessionConfig struct {
	KeySize  int `yaml:"key_size"`
	Duration time.Duration
}

SessionConfig defines configs related to user sessions

Jump to

Keyboard shortcuts

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