Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRepositories         = errors.New("no repositories configured")
	ErrRepositoryNameEmpty    = errors.New("repository name is required")
	ErrRepositoryNameReserved = errors.New("repository name is reserved")
	ErrRepositoryNameInvalid  = errors.New("repository name is invalid")
	ErrNoFeeds                = errors.New("at least one feed is required")
	ErrFeedTypeEmpty          = errors.New("feed type not specified")
	ErrFeedTypeInvalid        = errors.New("invalid feed type")
	ErrFeedLocationEmpty      = errors.New("feed location not specified")
	ErrFeedLocationPort       = errors.New("feed location cannot contain port")
	ErrFeedLocationInvalid    = errors.New("feed location is not a valid path")
	ErrFeedLocationScheme     = errors.New("feed location should not include URL scheme")
	ErrFeedLocationQuery      = errors.New("feed location cannot contain query strings")
	ErrFeedLocationFragment   = errors.New("feed location cannot contain fragments")
	ErrPoolModeInvalid        = errors.New("pool mode must be either 'hierarchical' or 'redirect'")
	ErrNoChangesRequiresDist  = errors.New("no_changes requires distribution mappings to be configured")
)

Validation errors

Functions

This section is empty.

Types

type CleanupConfig

type CleanupConfig struct {
	OlderThanDays int `yaml:"older_than_days"`
	KeepLast      int `yaml:"keep_last"`
}

CleanupConfig contains deployment cleanup settings

type CloudflareConfig

type CloudflareConfig struct {
	APIToken    string        `yaml:"api_token,omitempty"`
	AccountID   string        `yaml:"account_id,omitempty"`
	ProjectName string        `yaml:"project_name,omitempty"`
	Cleanup     CleanupConfig `yaml:"cleanup,omitempty"`
}

CloudflareConfig contains Cloudflare Pages deployment configuration

type Config

type Config struct {
	Directories  DirectoriesConfig   `yaml:"directories"`
	HTTP         HTTPConfig          `yaml:"http,omitempty"`
	Signing      SigningConfig       `yaml:"signing"`
	GitHub       GitHubConfig        `yaml:"github,omitempty"`
	Cloudflare   CloudflareConfig    `yaml:"cloudflare,omitempty"`
	URL          string              `yaml:"url"`
	Generate     GenerateConfig      `yaml:"generate,omitempty"`
	Web          WebConfig           `yaml:"web,omitempty"`
	Serve        ServeConfig         `yaml:"serve,omitempty"`
	Workers      WorkersConfig       `yaml:"workers"`
	Repositories []*RepositoryConfig `yaml:"repositories"` // Loaded from Directories.Repositories/*.yaml
	ConfigDir    string              `yaml:"-"`            // Directory containing config.yaml (set during Load)
}

Config represents the complete application configuration

func Load

func Load(configPath string) (*Config, error)

Load loads the configuration from the specified path or searches default locations

type DirectoriesConfig

type DirectoriesConfig struct {
	Root         string `yaml:"root"`
	Repositories string `yaml:"repositories"` // Relative to config dir if not absolute
	Downloads    string `yaml:"downloads"`    // Relative to Root if not absolute
	Trusted      string `yaml:"trusted"`      // Relative to Root if not absolute
	Cache        string `yaml:"cache"`        // Relative to Root if not absolute, stores parsed file cache
	Staging      string `yaml:"staging"`      // Relative to Root if not absolute, contains timestamped build directories
	Public       string `yaml:"public"`       // Relative to Root if not absolute
}

DirectoriesConfig defines directory paths

func (*DirectoriesConfig) GetCachePath added in v0.0.14

func (d *DirectoriesConfig) GetCachePath() string

GetCachePath returns the absolute path to the cache directory

func (*DirectoriesConfig) GetDownloadsCachePath added in v0.0.15

func (d *DirectoriesConfig) GetDownloadsCachePath() string

GetDownloadsCachePath returns the absolute path to the cache subtree mirroring the downloads directory

func (*DirectoriesConfig) GetDownloadsPath

func (d *DirectoriesConfig) GetDownloadsPath() string

GetDownloadsPath returns the absolute path to the downloads directory

func (*DirectoriesConfig) GetPublicPath

func (d *DirectoriesConfig) GetPublicPath() string

GetPublicPath returns the absolute path to the public directory

func (*DirectoriesConfig) GetStagingPath

func (d *DirectoriesConfig) GetStagingPath() string

GetStagingPath returns the absolute path to the staging directory

func (*DirectoriesConfig) GetTrustedCachePath added in v0.0.15

func (d *DirectoriesConfig) GetTrustedCachePath() string

GetTrustedCachePath returns the absolute path to the cache subtree mirroring the trusted directory

func (*DirectoriesConfig) GetTrustedPath

func (d *DirectoriesConfig) GetTrustedPath() string

GetTrustedPath returns the absolute path to the trusted directory

type GenerateConfig

type GenerateConfig struct {
	PoolMode string   `yaml:"pool_mode,omitempty"` // "hierarchical" or "redirect"
	Compose  []string `yaml:"compose,omitempty"`   // List of composers to run
	KeepLast int      `yaml:"keep_last"`           // Number of staging builds to keep
}

GenerateConfig contains repository generation configuration

type GitHubConfig

type GitHubConfig struct {
	Token string `yaml:"token,omitempty"` // GitHub personal access token
}

GitHubConfig contains GitHub API configuration

type HTTPConfig

type HTTPConfig struct {
	UserAgent       string `yaml:"user_agent,omitempty"`         // Custom User-Agent header
	Timeout         int    `yaml:"timeout"`                      // Request timeout in seconds
	MaxIdleConns    int    `yaml:"max_idle_conns,omitempty"`     // Maximum idle connections
	MaxConnsPerHost int    `yaml:"max_conns_per_host,omitempty"` // Maximum connections per host
}

HTTPConfig contains HTTP client configuration

type RepositoryConfig

type RepositoryConfig struct {
	Name string `yaml:"-"` // Derived from filename
	// Description is a markdown-formatted description of the repository (GitHub-flavored markdown)
	Description string `yaml:"description,omitempty"`
	// Icon is the name of an icon from simpleicons.org (e.g., "immich") or empty to try repository name
	// Can be overridden in global config.yaml web.icon_urls to use custom URL
	Icon                     string `yaml:"icon,omitempty"`
	common.RepositoryOptions `yaml:",inline"`
	Verification             VerificationConfig  `yaml:"verification,omitempty"`
	Feeds                    []*feed.FeedOptions `yaml:"feeds"`
}

RepositoryConfig represents a single repository configuration

type ServeConfig

type ServeConfig struct {
	Host string `yaml:"host,omitempty"` // Host to bind to (default: localhost)
	Port int    `yaml:"port,omitempty"` // Port to listen on (default: 8080)
}

ServeConfig contains HTTP server configuration

type SigningConfig

type SigningConfig struct {
	PrivateKey string `yaml:"private_key"`
	PublicKey  string `yaml:"public_key"`
	Passphrase string `yaml:"passphrase,omitempty"` // Optional passphrase for the private key
}

SigningConfig contains GPG signing configuration

func (*SigningConfig) GetPrivateKeyPath

func (s *SigningConfig) GetPrivateKeyPath(configDir string) string

GetPrivateKeyPath returns the absolute path to the private key

func (*SigningConfig) GetPublicKeyPath

func (s *SigningConfig) GetPublicKeyPath(configDir string) string

GetPublicKeyPath returns the absolute path to the public key

type TailwindConfig

type TailwindConfig struct {
	Release string `yaml:"release,omitempty"` // Specific release version to use (e.g., "v4.1.0"), empty = latest
}

TailwindConfig contains Tailwind CSS configuration

type VerificationConfig

type VerificationConfig struct {
	Keyring string   `yaml:"keyring,omitempty"`
	Keys    []string `yaml:"keys,omitempty"`
}

VerificationConfig contains package verification settings

func (*VerificationConfig) GetKeyPaths

func (v *VerificationConfig) GetKeyPaths(configDir string) []string

GetKeyPaths returns absolute paths for all keys

func (*VerificationConfig) GetKeyringPath

func (v *VerificationConfig) GetKeyringPath(configDir string) string

GetKeyringPath returns the absolute path to the keyring

type WebConfig

type WebConfig struct {
	Tailwind TailwindConfig    `yaml:"tailwind,omitempty"`
	IconURLs map[string]string `yaml:"icon_urls,omitempty"`
}

WebConfig contains web composer configuration

func (*WebConfig) GetIconURLs

func (w *WebConfig) GetIconURLs() map[string]string

GetIconURLs returns the icon URLs with defaults applied

type WorkersConfig

type WorkersConfig struct {
	Main        uint `yaml:"main"`
	Download    uint `yaml:"download"`
	Compression uint `yaml:"compression"`
}

WorkersConfig defines worker pool sizes

Jump to

Keyboard shortcuts

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