Documentation
¶
Overview ¶
Package config loads and validates the runakefli YAML configuration file. It supports strict YAML parsing (unknown keys are an error), environment variable expansion, and password_file for ClickHouse credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
PushdownModes are the valid values for query.pushdown.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server struct {
HTTPListenAddress string `yaml:"http_listen_address"`
HTTPListenPort int `yaml:"http_listen_port"`
HTTPServerReadTimeout time.Duration `yaml:"http_server_read_timeout"` // Loki/dskit default 30s
HTTPServerReadHeaderTimeout time.Duration `yaml:"http_server_read_header_timeout"` // 0 = use the read timeout
HTTPServerWriteTimeout time.Duration `yaml:"http_server_write_timeout"` // Loki/dskit default 30s
HTTPServerIdleTimeout time.Duration `yaml:"http_server_idle_timeout"` // Loki/dskit default 120s
GracefulShutdownTimeout time.Duration `yaml:"graceful_shutdown_timeout"` // Loki/dskit default 30s
RegisterInstrumentation bool `yaml:"register_instrumentation"` // Loki/dskit default true; serves /metrics and /debug/pprof
LogLevel dskitlog.Level `yaml:"log_level"` // dskit level; default info
LogFormat string `yaml:"log_format"` // logfmt | json; default logfmt
} `yaml:"server"`
AuthEnabled bool `yaml:"auth_enabled"`
ClickHouse struct {
Addr []string `yaml:"addr"`
Database string `yaml:"database"`
Username string `yaml:"username"`
Password string `yaml:"password"`
PasswordFile string `yaml:"password_file"` // file holding the password; mutually exclusive with password
Cluster string `yaml:"cluster"` // remote_servers name; empty = single server
Replicated bool `yaml:"replicated"` // Replicated*MergeTree on the cluster (default true)
ReplicaPath string `yaml:"replica_path"` // optional; default: server's default_replica_path
ReplicaName string `yaml:"replica_name"` // optional; default: server's default_replica_name
Settings map[string]any `yaml:"settings"` // extra ClickHouse session settings, override topology defaults
DialTimeout time.Duration `yaml:"dial_timeout"` // connect and pool-acquire timeout; default 5s
ReadTimeout time.Duration `yaml:"read_timeout"` // longest wait for a server packet; default 5m
MaxOpenConns int `yaml:"max_open_conns"` // connection pool size; default 100
MaxIdleConns int `yaml:"max_idle_conns"` // idle connections kept; default 20
} `yaml:"clickhouse"`
Query struct {
Pushdown string `yaml:"pushdown"` // on | off | downstream; default on
// Querier multi-tenant settings (Loki's querier block).
Querier struct {
MultiTenantQueriesEnabled bool `yaml:"multi_tenant_queries_enabled"`
} `yaml:"querier"`
} `yaml:"query"`
Compactor struct {
CompactionInterval time.Duration `yaml:"compaction_interval"` // delete processing loop
DeleteRequestCancelPeriod time.Duration `yaml:"delete_request_cancel_period"` // deletes run after this
DeleteMaxInterval time.Duration `yaml:"delete_max_interval"`
RetentionEnabled bool `yaml:"retention_enabled"` // retention sweeper; Loki's default is false
} `yaml:"compactor"`
Ruler lokiruler.Config `yaml:"ruler"` // Loki's ruler block, Loki's keys and defaults
RulerStorage rulestore.Config `yaml:"ruler_storage"` // the ruler runs only when this is set
LimitsConfig validation.Limits `yaml:"limits_config"`
}
Config is the top-level runakefli configuration.
func Load ¶
Load reads the YAML config at path. With expandEnv, ${VAR} and ${VAR:-default} are expanded first (Loki's -config.expand-env). Unknown keys are an error, as in Loki.
func (*Config) CHOptions ¶
func (c *Config) CHOptions(db string) *clickhouse.Options
CHOptions returns the clickhouse-go options for a connection to db.
func (*Config) CHSettings ¶
func (c *Config) CHSettings() clickhouse.Settings
CHSettings returns the session settings for every ClickHouse connection.
func (*Config) RulerEnabled ¶
RulerEnabled reports whether ruler_storage is configured (Loki's rule for starting the ruler in the single binary).