Add Jacket indexer with capabilities implemented
This commit is contained in:
@@ -1,10 +1,42 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
IndexerTypeJackett IndexerType = "jackett"
|
||||
)
|
||||
|
||||
type IndexerType string
|
||||
|
||||
type Config struct {
|
||||
App struct {
|
||||
Port string `yaml:"port"`
|
||||
Host string `yaml:"host"`
|
||||
Port string `yaml:"port"`
|
||||
} `yaml:"app"`
|
||||
|
||||
Indexer struct {
|
||||
Url string `yaml:"url"`
|
||||
Port string `yaml:"port"`
|
||||
Type IndexerType `yaml:"type"`
|
||||
ApiKey string `yaml:"api_key"`
|
||||
} `yaml:"indexer"`
|
||||
}
|
||||
|
||||
func (t *IndexerType) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
var value string
|
||||
if err := unmarshal(&value); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch IndexerType(value) {
|
||||
case IndexerTypeJackett:
|
||||
*t = IndexerType(value)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unknown indexer type: %s", value)
|
||||
}
|
||||
}
|
||||
|
||||
func NewConfig() *Config {
|
||||
|
||||
Reference in New Issue
Block a user