mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-29 21:27:05 +02:00
Dynamic per-backend configuration options
This commit is contained in:
parent
ae5f1c5f26
commit
c9fa21be73
14 changed files with 262 additions and 17 deletions
|
@ -34,6 +34,18 @@ type ListenBrainzApiBackend struct {
|
|||
|
||||
func (b *ListenBrainzApiBackend) Name() string { return "listenbrainz" }
|
||||
|
||||
func (b *ListenBrainzApiBackend) Options() *[]models.BackendOption {
|
||||
return &[]models.BackendOption{{
|
||||
Name: "username",
|
||||
Label: "User name",
|
||||
Type: models.String,
|
||||
}, {
|
||||
Name: "token",
|
||||
Label: "Access token",
|
||||
Type: models.Secret,
|
||||
}}
|
||||
}
|
||||
|
||||
func (b *ListenBrainzApiBackend) FromConfig(config *viper.Viper) models.Backend {
|
||||
b.client = NewClient(config.GetString("token"))
|
||||
b.client.MaxResults = MaxItemsPerGet
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue