config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPNAME          = "spogo"
	CONFIGFILE       = "config.yaml"
	ACCESSTOKENFILE  = "access-token.json"
	REQUESTTOKENFILE = "refresh-token.json"
	DEVICEFILE       = "device.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Spotify Spotify `yaml:"spotify"`

	Color struct {
		Album struct {
			Name   int `yaml:"name"`
			Artist int `yaml:"artist"`
			Other  int `yaml:"other"`
		} `yaml:"album"`
		Track struct {
			Name   int `yaml:"name"`
			Artist int `yaml:"artist"`
			Other  int `yaml:"other"`
		} `yaml:"track"`
	} `yaml:"color"`
	// contains filtered or unexported fields
}

The struct that holds configuration options from "config.yaml", including spotify client information, and all information about directory locations.

func New

func New() (*Config, error)

Creates spogo config root directory, "config.yaml", and spogo cache directory.

func (*Config) CachePath

func (c *Config) CachePath() string

Returns the config file, ".cache/spogo" for unix.

func (*Config) DeviceFile

func (c *Config) DeviceFile() string

Returns the config file, ".cache/spogo/device.json" for unix.

func (*Config) Exists

func (c *Config) Exists() bool

Returns true if the config file, "config.yaml", exists.

func (*Config) FilePath

func (c *Config) FilePath() string

Returns the config file, ".config/spogo/config.yaml" for unix.

func (*Config) Load

func (c *Config) Load() error

Loads all config options and client ID & client secret from "config.yaml".

func (*Config) Path

func (c *Config) Path() string

Returns the config path, ".config/spogo" for unix.

type Spotify

type Spotify struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
}

func (*Spotify) Valid

func (s *Spotify) Valid() (bool, error)

Attempts to do the "client credentials" authentication flow to test validity of spotify client ID and client secret.

Jump to

Keyboard shortcuts

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