config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 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 Credentials `yaml:"spotify"`
	// 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) HelpString added in v0.2.0

func (c *Config) HelpString() string

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 Credentials added in v0.2.0

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

func (*Credentials) Valid added in v0.2.0

func (c *Credentials) 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