config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 7 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 {
	Spotify  SpotifyConfig  `toml:"spotify"`
	Sonos    SonosConfig    `toml:"sonos"`
	Defaults DefaultsConfig `toml:"defaults"`
	Tail     TailConfig     `toml:"tail"`
	TUI      TUIConfig      `toml:"tui"`
	Log      LogConfig      `toml:"log"`
}

Config is the root configuration structure.

func Default

func Default() *Config

Default returns a Config populated with sensible defaults.

func Load

func Load() (*Config, error)

Load reads configuration from standard locations with environment overrides. Search order: ~/.riffrc, $XDG_CONFIG_HOME/riff/config.toml, ~/.config/riff/config.toml

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads configuration from a specific file path.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults fills in zero values with sensible defaults.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors.

type DefaultsConfig

type DefaultsConfig struct {
	Volume  int    `toml:"volume"`
	Shuffle bool   `toml:"shuffle"`
	Repeat  string `toml:"repeat"`
	Device  string `toml:"device"`
}

DefaultsConfig holds default playback settings.

func (*DefaultsConfig) Validate

func (c *DefaultsConfig) Validate() error

Validate checks DefaultsConfig for errors.

type LogConfig

type LogConfig struct {
	Level string `toml:"level"`
	File  string `toml:"file"`
}

LogConfig holds logging settings.

func (*LogConfig) Validate

func (c *LogConfig) Validate() error

Validate checks LogConfig for errors.

type SonosConfig

type SonosConfig struct {
	DefaultRoom      string `toml:"default_room"`
	DiscoveryTimeout int    `toml:"discovery_timeout"`
}

SonosConfig holds Sonos connection settings.

func (*SonosConfig) Validate

func (c *SonosConfig) Validate() error

Validate checks SonosConfig for errors.

type SpotifyConfig

type SpotifyConfig struct {
	ClientID    string `toml:"client_id"`
	RedirectURI string `toml:"redirect_uri"`
}

SpotifyConfig holds Spotify API settings.

func (*SpotifyConfig) Validate

func (c *SpotifyConfig) Validate() error

Validate checks SpotifyConfig for errors.

type TUIConfig

type TUIConfig struct {
	Theme           string `toml:"theme"`
	RefreshInterval int    `toml:"refresh_interval"`
}

TUIConfig holds terminal UI settings.

func (*TUIConfig) Validate

func (c *TUIConfig) Validate() error

Validate checks TUIConfig for errors.

type TailConfig

type TailConfig struct {
	Enabled  bool `toml:"enabled"`
	Interval int  `toml:"interval"`
}

TailConfig holds settings for tail/follow mode.

func (*TailConfig) Validate

func (c *TailConfig) Validate() error

Validate checks TailConfig for errors.

Jump to

Keyboard shortcuts

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