go.bigb.es/curator
Index
Functions
func ResolveValue(value string) (string, error)
Types
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"` Listen string `mapstructure:"listen"` Cache string `mapstructure:"cache"` AuthTokens string `mapstructure:"auth_tokens"` AdminToken string `mapstructure:"admin_token"` }
Load reads configuration from a YAML file and environment variables.
func (cfg *Config) Dump() string
Dump returns a human-readable configuration summary with secrets masked.
func (cfg *Config) FallbackMode() FallbackMode
FallbackMode returns the configured fallback mode, or "" if none.
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.
type FallbackConfig struct { Mode FallbackMode `mapstructure:"mode"` Upstream string `mapstructure:"upstream"` }
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 )
func (m FallbackMode) RequiresUpstream() bool
RequiresUpstream reports whether the mode needs an upstream URL.
type InstrumentationConfig struct { Listen string `mapstructure:"listen"` MetricsPath string `mapstructure:"metrics_path"` HealthPath string `mapstructure:"health_path"` }
type Module struct { VCS string `json:"vcs"` Repo string `json:"repo"` Web string `json:"web"` Private bool `json:"private,omitempty"` }
Module represents a Go module configuration.
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.
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.
func (c *StorageConfig) S3() S3Config
S3 returns S3Config extracted from StorageConfig.
type SumdbConfig struct { Enabled bool `mapstructure:"enabled"` Key string `mapstructure:"key"` Upstream string `mapstructure:"upstream"` // upstream sumdb URL for non-local lookups }
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.