go.bigb.es/curator

v1.3.5
Doc Versions Source

Functions

f func ResolveValue

src
func ResolveValue(value string) (string, error)

ResolveValue resolves a configuration value. If it starts with "@", the remainder is treated as a file path and the file contents are returned. Otherwise the value is returned as-is.

Types

T type Config

src
type Config struct {
	Host            string                 `mapstructure:"host"`
	Database        *DatabaseConfig        `mapstructure:"database"`
	Storage         *StorageConfig         `mapstructure:"storage"`
	Fallback        *FallbackConfig        `mapstructure:"fallback"`
	Sumdb           *SumdbConfig           `mapstructure:"sumdb"`
	Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"`
	OIDC            *OIDCConfig            `mapstructure:"oidc"`
	Listen          string                 `mapstructure:"listen"`
	Cache           string                 `mapstructure:"cache"`
	AuthTokens      string                 `mapstructure:"auth_tokens"`
	AdminToken      string                 `mapstructure:"admin_token"`
}

f func Load

src
func Load(path string) (*Config, error)

Load reads configuration from a YAML file and environment variables.

m func (*Config) Dump

src
func (cfg *Config) Dump() string

Dump returns a human-readable configuration summary with secrets masked.

m func (*Config) FallbackMode

src

FallbackMode returns the configured fallback mode, or "" if none.

T type DatabaseConfig

src
type DatabaseConfig struct {
	Type string `mapstructure:"type"` // "sqlite" (default), "postgres"
	DSN  string `mapstructure:"dsn"`  // file path for sqlite, connection string for postgres
}

DatabaseConfig configures the module store database backend.

T type FallbackConfig

src
type FallbackConfig struct {
	Mode     FallbackMode `mapstructure:"mode"`
	Upstream string       `mapstructure:"upstream"`
}

T type FallbackMode

src
type FallbackMode string

FallbackMode controls behavior for modules not defined in config.

const (
	FallbackNone FallbackMode = ""

	FallbackRedirect FallbackMode = "redirect" // 302 redirect to upstream
	FallbackSync     FallbackMode = "sync"     // fetch upstream, cache synchronously, then serve
	FallbackAsync    FallbackMode = "async"    // fetch upstream, serve immediately, cache in background
)

m func (FallbackMode) RequiresUpstream

src
func (m FallbackMode) RequiresUpstream() bool

RequiresUpstream reports whether the mode needs an upstream URL.

T type InstrumentationConfig

src
type InstrumentationConfig struct {
	Listen      string `mapstructure:"listen"`
	MetricsPath string `mapstructure:"metrics_path"`
	HealthPath  string `mapstructure:"health_path"`
}

T type Module

src
type Module struct {
	VCS            string `json:"vcs"`
	Repo           string `json:"repo"`
	Web            string `json:"web"`
	Private        bool   `json:"private,omitempty"`
	CredentialName string `json:"credential_name,omitempty"`
}

Module represents a Go module configuration.

T type OIDCConfig

src
type OIDCConfig struct {
	Issuer       string `mapstructure:"issuer"`
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"` // supports @file
	RedirectURL  string `mapstructure:"redirect_url"`
}

OIDCConfig configures OpenID Connect authentication for the admin UI.

T type S3Config

src
type S3Config struct {
	Endpoint     string `mapstructure:"endpoint"`
	Bucket       string `mapstructure:"bucket"`
	Region       string `mapstructure:"region"`
	UsePathStyle bool   `mapstructure:"use_path_style"`
}

S3Config is kept for backward compatibility with NewS3Storage.

T type StorageConfig

src
type StorageConfig struct {
	Type         string `mapstructure:"type"`           // "memory", "disk", "s3" (default: "s3")
	Root         string `mapstructure:"root"`           // disk only
	Endpoint     string `mapstructure:"endpoint"`       // s3 only
	Bucket       string `mapstructure:"bucket"`         // s3 only
	Region       string `mapstructure:"region"`         // s3 only
	UsePathStyle bool   `mapstructure:"use_path_style"` // s3 only: path-style addressing for Garage, MinIO, etc.
	MaxBytes     int64  `mapstructure:"max_bytes"`      // memory only (0 = unlimited)
}

StorageConfig supports multiple storage backends.

m func (*StorageConfig) S3

src
func (c *StorageConfig) S3() S3Config

S3 returns S3Config extracted from StorageConfig.

T type SumdbConfig

src
type SumdbConfig struct {
	Enabled  bool   `mapstructure:"enabled"`
	Key      string `mapstructure:"key"`
	Upstream string `mapstructure:"upstream"` // upstream sumdb URL for non-local lookups
}

Source Files