Dynamic per-backend configuration options

This commit is contained in:
Philipp Wolfer 2023-12-05 23:25:15 +01:00
parent ae5f1c5f26
commit c9fa21be73
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
14 changed files with 262 additions and 17 deletions

View file

@ -43,6 +43,22 @@ type LastfmApiBackend struct {
func (b *LastfmApiBackend) Name() string { return "lastfm" }
func (b *LastfmApiBackend) Options() *[]models.BackendOption {
return &[]models.BackendOption{{
Name: "username",
Label: "User name",
Type: models.String,
}, {
Name: "client-id",
Label: "Client ID",
Type: models.String,
}, {
Name: "client-secret",
Label: "Client secret",
Type: models.Secret,
}}
}
func (b *LastfmApiBackend) FromConfig(config *viper.Viper) models.Backend {
clientId := config.GetString("client-id")
clientSecret := config.GetString("client-secret")