config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: AGPL-3.0 Imports: 24 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
	FileToken     TokenConfig
	TOTP          TOTPConfig
}

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 to load 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 cached.

func TestingConfig added in v0.14.0

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

func (Config) NewSearcher added in v0.14.0

func (c Config) NewSearcher() search.Searcher

func (Config) Write added in v0.17.0

func (c Config) Write(w io.Writer) error

type ContentDescription added in v0.12.1

type ContentDescription struct {
	ContentType string `json:"contentType"`
	URL         string `json:"url"`
}

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
	SearchIndexName      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
	SearchIndexName string
	SearchLimit     int
}

type ProgressConfig

type ProgressConfig struct {
	DB DatabaseConfig
}

type RadioStream

type RadioStream struct {
	Creator     string
	Title       string
	Image       string
	Description string
	Source      []ContentDescription
}

type RecommendConfig

type RecommendConfig struct {
	When []DateRecommend
}

type ServerConfig

type ServerConfig struct {
	Listen      string
	KeyDir      string
	DataDir     string
	MediaDir    string
	ImageClient client.Config
	IncludeDirs []string
	ExcludeDirs []string
}

type SetlistAPIConfig

type SetlistAPIConfig struct {
	ApiKey string
}

type TMDBAPIConfig

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

type TOTPConfig added in v0.15.0

type TOTPConfig struct {
	Issuer string
}

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
	SearchIndexName      string
	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