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

@ -33,6 +33,22 @@ type MalojaApiBackend struct {
func (b *MalojaApiBackend) Name() string { return "maloja" }
func (b *MalojaApiBackend) Options() *[]models.BackendOption {
return &[]models.BackendOption{{
Name: "server-url",
Label: "Server URL",
Type: models.String,
}, {
Name: "token",
Label: "Access token",
Type: models.Secret,
}, {
Name: "nofix",
Label: "Disable auto correction of submitted listens",
Type: models.Bool,
}}
}
func (b *MalojaApiBackend) FromConfig(config *viper.Viper) models.Backend {
b.client = NewClient(
config.GetString("server-url"),