config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Default settings
	DefaultSource string `yaml:"default_source"`
	DownloadDir   string `yaml:"download_dir"`
	MaxConcurrent int    `yaml:"max_concurrent"`

	// API Keys
	APIKeys map[string]string `yaml:"api_keys"`

	// Default fetch options
	Defaults map[string]DefaultOptions `yaml:"defaults"`

	// Database settings
	Database DatabaseConfig `yaml:"database"`
}

Config represents the application configuration

func Default

func Default() *Config

Default returns a configuration with default values

func Load

func Load() (*Config, error)

Load loads configuration from the config file and environment

func (*Config) GetWallhavenAPIKey

func (c *Config) GetWallhavenAPIKey() string

GetWallhavenAPIKey returns the Wallhaven API key from config or environment

func (*Config) Save

func (c *Config) Save() error

Save saves the current configuration to the config file

type DatabaseConfig

type DatabaseConfig struct {
	Path       string `yaml:"path"`
	AutoVacuum bool   `yaml:"auto_vacuum"`
}

DatabaseConfig represents database configuration

type DefaultOptions

type DefaultOptions struct {
	Categories    string   `yaml:"categories"`
	Resolution    string   `yaml:"resolution"`
	Sort          string   `yaml:"sort"`
	Limit         int      `yaml:"limit"`
	AspectRatios  []string `yaml:"aspect_ratios"`
	MinWidth      int      `yaml:"min_width"`
	MinHeight     int      `yaml:"min_height"`
	MaxWidth      int      `yaml:"max_width"`
	MaxHeight     int      `yaml:"max_height"`
	OnlyLandscape bool     `yaml:"only_landscape"`
}

DefaultOptions represents default options for each source

Jump to

Keyboard shortcuts

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