config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config contains the dissic config and methods to add default values and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Reddit              Reddit     `yaml:"reddit"`
	Spotify             Spotify    `yaml:"spotify"`
	Playlists           []Playlist `yaml:"playlists"`
	HTTPPort            int        `yaml:"http-port"`
	Verbose             bool       `yaml:"verbose"`
	AuthOpenBrowser     bool       `yaml:"auth-open-browser"`
	Version             string
	PlaylistDescription string
}

Config holds the entire dissic config (config.yaml and env vars)

func Load

func Load() (*Config, error)

Load reads config from file and environment variables. It also adds default values where applicable and validates the config before returning.

type Playlist

type Playlist struct {
	Name       string   `yaml:"name"`
	ID         string   `yaml:"id"`
	Subreddits []string `yaml:"subreddits"`
}

Playlist contains the playlist configuration

type Reddit

type Reddit struct {
	Username             string `yaml:"username"`
	RequestRate          int    `yaml:"request-rate"`
	MaxRetryAttempts     int    `yaml:"max-retry-attempts"`
	RetryAttemptWaitTime int    `yaml:"retry-attempt-wait-time"`
	Subreddits           []string
}

Reddit holds the reddit related configuration.

type Spotify

type Spotify struct {
	ClientID     string `yaml:"client-id"`
	ClientSecret string `yaml:"client-secret"`
}

Spotify holds the reddit related configuration.

Jump to

Keyboard shortcuts

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