config

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads server configuration with precedence flags > env (PUSHQ_*) > YAML file > defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Key  string `yaml:"key"`
	Role Role   `yaml:"role"`
}

type Config

type Config struct {
	DB         string     `yaml:"db"`
	Listen     string     `yaml:"listen"`
	APIKeys    []APIKey   `yaml:"api_keys"`
	Dispatcher Dispatcher `yaml:"dispatcher"`
	Limits     Limits     `yaml:"limits"`
	Retention  Retention  `yaml:"retention"`
	Metrics    Metrics    `yaml:"metrics"`
	Log        Log        `yaml:"log"`
}

func Default

func Default() Config

func Load

func Load(path string) (Config, error)

Load builds the config: defaults, then the YAML file (if path != ""), then PUSHQ_* environment variables. Flag overrides are applied by the caller.

func (Config) Validate

func (c Config) Validate() error

type Dispatcher

type Dispatcher struct {
	GlobalConcurrency int           `yaml:"global_concurrency"`
	PerQueueClaimCap  int           `yaml:"per_queue_claim_cap"`
	ReconcileInterval time.Duration `yaml:"reconcile_interval"`
	DrainTimeout      time.Duration `yaml:"drain_timeout"`
	SweepInterval     time.Duration `yaml:"sweep_interval"`
	CleanupInterval   time.Duration `yaml:"cleanup_interval"`
	LeaseGrace        time.Duration `yaml:"lease_grace"`
}

type Limits

type Limits struct {
	MaxBodyBytes     int64         `yaml:"max_body_bytes"`
	MaxHeadersBytes  int64         `yaml:"max_headers_bytes"`
	MaxScheduleAhead time.Duration `yaml:"max_schedule_ahead"`
	DedupWindow      time.Duration `yaml:"dedup_window"`
}

type Log

type Log struct {
	Level  string `yaml:"level"`  // debug|info|warn|error
	Format string `yaml:"format"` // text|json
}

type Metrics

type Metrics struct {
	Public bool `yaml:"public"`
}

type Retention

type Retention struct {
	Succeeded time.Duration `yaml:"succeeded"`
	Failed    time.Duration `yaml:"failed"`
}

type Role

type Role string
const (
	RoleAdmin  Role = "admin"
	RoleWriter Role = "writer"
)

Jump to

Keyboard shortcuts

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