Documentation
¶
Overview ¶
Package config centralizes OpenDeezer's user configuration (env vars + ~/.config/opendeezer files) for the bits shared between the TUI and the GUI engine (corelib): the control API and Discord Rich Presence settings.
Index ¶
- func Dir() (string, error)
- func IsLoopbackAddr(addr string) bool
- func LoadDiscordAppID() string
- func LoadPeers() []string
- func NormalizePeer(addr string) (base, hostport string)
- func SaveControlEnabled(enabled bool, addr string) error
- func SaveControlToken(token string) error
- func SaveEQ(eq EQ) error
- type Control
- type EQ
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLoopbackAddr ¶
IsLoopbackAddr reports whether a host:port binds only the loopback interface.
func LoadDiscordAppID ¶
func LoadDiscordAppID() string
LoadDiscordAppID returns the Discord application id for Rich Presence, from $OPENDEEZER_DISCORD_APP_ID or ~/.config/opendeezer/discord-app-id.txt. Empty disables the feature.
func LoadPeers ¶
func LoadPeers() []string
LoadPeers returns manually-configured Connect peer addresses (host[:port]), from $OPENDEEZER_CONNECT_PEERS (comma-separated) and ~/.config/opendeezer/connect-peers.txt (one per line). These are merged into the device picker alongside LAN discovery, so Connect works over networks that carry no multicast/broadcast (e.g. Tailscale/VPN — unicast-only meshes).
func NormalizePeer ¶
NormalizePeer turns user input ("host", "host:port", "http://host:port") into a base URL + host:port, defaulting the port to 7654. Returns ("","") if empty.
func SaveControlEnabled ¶ added in v1.5.1
SaveControlEnabled persists whether the control API starts automatically, so a Settings UI can flip it without editing env vars or config files by hand. addr is the bind address to remember while enabled (typically the current LoadControl().Addr); pass "" to disable.
func SaveControlToken ¶ added in v1.5.1
SaveControlToken persists the control-API bearer token. "" clears it, which falls back to same-account auth on a LAN bind.
Types ¶
type Control ¶
type Control struct {
Enabled bool
Addr string // host:port; "" -> 127.0.0.1:7654
Token string // bearer token ("" = no auth, localhost only)
SameAccount bool // require a matching Deezer account when no token (LAN)
}
Control holds the control-API settings (remote control + MCP).
func LoadControl ¶
func LoadControl() Control
LoadControl reads the control-API config from $OPENDEEZER_CONTROL ("1"/addr) + $OPENDEEZER_CONTROL_TOKEN, else ~/.config/opendeezer/{control.txt,control-token.txt}.
type EQ ¶ added in v1.7.0
type EQ struct {
Enabled bool `json:"enabled"`
Mono bool `json:"mono"`
PreampDB float64 `json:"preampDb"`
GainsDB []float64 `json:"gainsDb"`
Preset string `json:"preset"`
}
EQ is the persisted equalizer + mono-downmix state. It is loaded and saved by the audio engine itself (not per client), so the TUI, every GUI and the control API all share one set of settings through ~/.config/opendeezer.