config

package
v0.11.11 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package config collects all configuration for the server with a single model which allows for easy viper-based configuration files.

Index

Constants

View Source
const (
	MediaMusic = "music"
	MediaVideo = "video"
)

Variables

View Source
var (
	ErrTestConfig   = errors.New("missing test config")
	ErrInvalidCache = errors.New("invalid cache entry")
)

Functions

func AddConfigPath

func AddConfigPath(path string)

func SetConfigFile

func SetConfigFile(path string)

func SetConfigName

func SetConfigName(name string)

Types

type ActivityConfig

type ActivityConfig struct {
	DB                 DatabaseConfig
	ActivityLimit      int
	RecentLimit        int
	PopularLimit       int
	RecentMoviesTitle  string
	RecentTracksTitle  string
	PopularMoviesTitle string
	PopularTracksTitle string
}

type AssistantConfig

type AssistantConfig struct {
	ProjectID       string
	TrackLimit      int
	RecentLimit     int
	Welcome         AssistantResponse
	Play            AssistantResponse
	Error           AssistantResponse
	Link            AssistantResponse
	Linked          AssistantResponse
	Guest           AssistantResponse
	Recent          AssistantResponse
	Release         AssistantResponse
	SuggestionAuth  string
	SuggestionNew   string
	MediaObjectName Template
	MediaObjectDesc Template
}

type AssistantResponse

type AssistantResponse struct {
	Speech Template
	Text   Template
}

type AuthConfig

type AuthConfig struct {
	DB            DatabaseConfig
	SessionAge    time.Duration
	CodeAge       time.Duration
	SecureCookies bool
	AccessToken   TokenConfig
	MediaToken    TokenConfig
	CodeToken     TokenConfig
}

type Config

type Config struct {
	Auth      AuthConfig
	Buckets   []bucket.Config
	Client    client.Config
	Fanart    fanart.Config
	LastFM    lastfm.Config
	Music     MusicConfig
	TMDB      TMDBAPIConfig
	Search    search.Config
	Server    ServerConfig
	Video     VideoConfig
	Assistant AssistantConfig
	Podcast   PodcastConfig
	Progress  ProgressConfig
	Activity  ActivityConfig
}

func GetConfig

func GetConfig() (*Config, error)

GetConfig uses viper loads the default configuration.

func LoadConfig

func LoadConfig(dir string) (*Config, error)

LoadConfig uses viper to load a config file in the provided directory. The result is returned as a Config and cached.

func TestConfig

func TestConfig() (*Config, error)

func (Config) NewCacheOnlyGetter

func (c Config) NewCacheOnlyGetter() client.Getter

func (Config) NewGetter

func (c Config) NewGetter() client.Getter

func (Config) NewGetterWith

func (c Config) NewGetterWith(o client.Config) client.Getter

type DatabaseConfig

type DatabaseConfig struct {
	Driver string
	Source string
	Logger string
}

func (DatabaseConfig) GormConfig

func (c DatabaseConfig) GormConfig() *gorm.Config

type DateRecommend

type DateRecommend struct {
	Name   string
	Layout string
	Match  string
	Query  string
}

type MusicConfig

type MusicConfig struct {
	ArtistFile           string
	ArtistRadioBreadth   int
	ArtistRadioDepth     int
	DB                   DatabaseConfig
	DeepLimit            int
	PopularLimit         int
	RadioGenres          []string
	RadioLimit           int
	RadioOther           map[string]string
	RadioSearchLimit     int
	RadioSeries          []string
	RadioStreams         []RadioStream
	Recent               time.Duration
	RecentLimit          int
	ReleaseCountries     []string
	SearchLimit          int
	SimilarArtistsLimit  int
	SimilarReleases      time.Duration
	SimilarReleasesLimit int
	SinglesLimit         int

	SyncInterval        time.Duration
	PopularSyncInterval time.Duration
	SimilarSyncInterval time.Duration
	CoverSyncInterval   time.Duration
	// contains filtered or unexported fields
}

func (*MusicConfig) UserArtistID

func (mc *MusicConfig) UserArtistID(name string) (string, bool)

type PodcastConfig

type PodcastConfig struct {
	DB           DatabaseConfig
	Series       []string
	Client       client.Config
	RecentLimit  int
	EpisodeLimit int
	SyncInterval time.Duration
	SearchLimit  int
}

type ProgressConfig

type ProgressConfig struct {
	DB DatabaseConfig
}

type RadioStream

type RadioStream struct {
	Creator  string
	Title    string
	Image    string
	Location string
}

type RecommendConfig

type RecommendConfig struct {
	When []DateRecommend
}

type ServerConfig

type ServerConfig struct {
	Listen      string
	DataDir     string
	MediaDir    string
	ImageClient client.Config
}

type SetlistAPIConfig

type SetlistAPIConfig struct {
	ApiKey string
}

type TMDBAPIConfig

type TMDBAPIConfig struct {
	tmdb.Config  `mapstructure:",squash"`
	FileTemplate Template
}

type Template

type Template struct {
	Text string
	// contains filtered or unexported fields
}

func (*Template) Execute

func (t *Template) Execute(vars interface{}) string

func (*Template) Template

func (t *Template) Template() *template.Template

type TokenConfig

type TokenConfig struct {
	Issuer     string
	Age        time.Duration
	Secret     string
	SecretFile string
}

type VideoConfig

type VideoConfig struct {
	DB                   DatabaseConfig
	ReleaseCountries     []string
	CastLimit            int
	CrewJobs             []string
	Recent               time.Duration
	RecentLimit          int
	SearchLimit          int
	Recommend            RecommendConfig
	SyncInterval         time.Duration
	PosterSyncInterval   time.Duration
	BackdropSyncInterval time.Duration
}

Jump to

Keyboard shortcuts

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