Documentation
¶
Overview ¶
Package config provides configuration loading and management for the GoSight server. It supports loading configuration from a YAML file and allows for environment variable overrides. The configuration includes settings for server address, storage engine, database path, logging, TLS settings, and debug options.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyEnvOverrides ¶
func ApplyEnvOverrides(cfg *Config)
func EnsureDefaultConfig ¶
Types ¶
type AlertBufferConfig ¶
type BufferEngineConfig ¶
type BufferEngineConfig struct {
Enabled bool `yaml:"enabled"`
FlushInterval time.Duration `yaml:"flush_interval"`
ShutdownFlushTimeout time.Duration `yaml:"shutdown_flush_timeout"`
MaxWorkers int `yaml:"max_workers"`
Metrics MetricBufferConfig `yaml:"metrics"`
Logs LogBufferConfig `yaml:"logs"`
Data DataBufferConfig `yaml:"data"`
Events EventBufferConfig `yaml:"events"`
Alerts AlertBufferConfig `yaml:"alerts"`
}
Buff
type Config ¶
type Config struct {
Server struct {
GRPCAddr string `yaml:"grpc_addr"`
HTTPAddr string `yaml:"http_addr"`
Environment string `yaml:"environment"`
SyncInterval time.Duration `yaml:"sync_interval" default:"5m"`
} `yaml:"server"`
Logs struct {
ErrorLogFile string `yaml:"error_log_file"`
AppLogFile string `yaml:"app_log_file"`
AccessLogFile string `yaml:"access_log_file"`
DebugLogFile string `yaml:"debug_log_file"`
LogLevel string `yaml:"log_level"`
}
Web struct {
StaticDir string `yaml:"static_dir"`
TemplateDir string `yaml:"template_dir"`
DefaultTitle string `yaml:"default_title"`
AuthProviders []string `yaml:"auth_providers"`
} `yaml:"web"`
TLS struct {
HttpsCertFile string `yaml:"https_cert_file"`
HttpsKeyFile string `yaml:"https_key_file"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
ClientCAFile string `yaml:"client_ca_file"`
} `yaml:"tls"`
Debug struct {
EnableReflection bool `yaml:"enable_reflection"`
} `yaml:"debug"`
// TODO - split up storage engine configs.
MetricStore struct {
Engine string `yaml:"engine"`
URL string `yaml:"url"`
Workers int `yaml:"workers"`
QueueSize int `yaml:"queue_size"`
BatchSize int `yaml:"batch_size"`
BatchTimeout int `yaml:"batch_timeout"`
BatchRetry int `yaml:"batch_retry"`
BatchInterval int `yaml:"batch_interval"`
} `yaml:"metricstore"`
LogStore struct {
Engine string `yaml:"engine"` // file, victoriametric etc
Dir string `yaml:"dir"`
Url string `yaml:"url,omitempty"` // optional URL for remote storage
Workers int `yaml:"workers"`
QueueSize int `yaml:"queue_size"`
BatchSize int `yaml:"batch_size"`
BatchTimeout int `yaml:"batch_timeout"`
BatchRetry int `yaml:"batch_retry"`
BatchInterval int `yaml:"batch_interval"`
}
UserStore struct {
Engine string `yaml:"engine"` // e.g. "postgres", "memory", "ldap"
DSN string `yaml:"dsn"` // e.g. PostgreSQL connection string
LDAPBase string `yaml:"ldap_base"` // optional: LDAP-specific config
} `yaml:"userstore"`
DataStore struct {
Engine string `yaml:"engine"` // "memory", "json", or "postgres"
Path string `yaml:"path,omitempty"` // optional path for JSON file
DSN string `yaml:"dsn,omitempty"` // optional DSN for PostgreSQL
} `yaml:"datastore"`
AlertStore struct {
Engine string `yaml:"engine"` // "memory", "json", or "postgres"
Path string `yaml:"path,omitempty"` // optional path for JSON file
DSN string `yaml:"dsn,omitempty"` // optional DSN for PostgreSQL
} `yaml:"alertstore"`
EventStore struct {
Engine string `yaml:"engine"` // "memory", "json", or "postgres"
Path string `yaml:"path"` // optional path for JSON file
DSN string `yaml:"dsn,omitempty"` // optional DSN for PostgreSQL
} `yaml:"eventstore"`
RuleStore struct {
Engine string `yaml:"engine"` // "memory", "json", or "postgres"
Path string `yaml:"path"` // optional path for JSON file
} `yaml:"rulestore"`
RouteStore struct {
Path string `yaml:"path"` // path for YAML file
} `yaml:"routestore"`
BufferEngine BufferEngineConfig `yaml:"buffer_engine"`
Auth struct {
SSOEnabled bool `yaml:"sso_enabled"`
MFASecret string `yaml:"mfa_secret_key"`
JWTSecret string `yaml:"jwt_secret"`
Google GoogleConfig `yaml:"google"`
} `yaml:"auth"`
}
func LoadConfig ¶
type DataBufferConfig ¶
type DataBufferConfig struct {
Enabled bool `yaml:"enabled"`
BufferSize int `yaml:"buffer_size"`
FlushInterval time.Duration `yaml:"flush_interval"`
DropOnOverflow bool `yaml:"drop_on_overflow"`
RetryFailedFlush bool `yaml:"retry_failed_flush"`
FlushOnDisconnect bool `yaml:"flush_on_disconnect"`
FallbackDisk DiskBufferConfig `yaml:"fallback_disk"`
}
type DiskBufferConfig ¶
type EventBufferConfig ¶
type GoogleConfig ¶
type GoogleConfig struct {
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
RedirectURI string `yaml:"redirect_uri"`
}
func (*GoogleConfig) ToOAuthConfig ¶
func (g *GoogleConfig) ToOAuthConfig() *oauth2.Config
type LogBufferConfig ¶
type MetricBufferConfig ¶
type MetricBufferConfig struct {
Enabled bool `yaml:"enabled"`
BufferSize int `yaml:"buffer_size"`
FlushInterval time.Duration `yaml:"flush_interval"`
DropOnOverflow bool `yaml:"drop_on_overflow"`
RetryFailedFlush bool `yaml:"retry_failed_flush"`
FlushOnDisconnect bool `yaml:"flush_on_disconnect"`
FallbackDisk DiskBufferConfig `yaml:"fallback_disk"`
}
Click to show internal directories.
Click to hide internal directories.