config

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Arr                     string         `koanf:"arr"`
	LogLevel                string         `koanf:"log-level" validate:"ValidateLogLevel"`
	LogFormat               string         `koanf:"log-format" validate:"in:console,json"`
	URL                     string         `koanf:"url" validate:"required|url"`
	ApiKey                  string         `koanf:"api-key" validate:"required|regex:(^[a-z0-9]{32}$)"`
	ApiKeyFile              string         `koanf:"api-key-file"`
	ApiVersion              string         `koanf:"api-version" validate:"required|in:v3,v4"`
	XMLConfig               string         `koanf:"config"`
	Port                    int            `koanf:"port" validate:"required"`
	Interface               string         `koanf:"interface" validate:"required|ip"`
	DisableSSLVerify        bool           `koanf:"disable-ssl-verify"`
	AuthUsername            string         `koanf:"auth-username"`
	AuthPassword            string         `koanf:"auth-password"`
	FormAuth                bool           `koanf:"form-auth"`
	EnableUnknownQueueItems bool           `koanf:"enable-unknown-queue-items"`
	EnableAdditionalMetrics bool           `koanf:"enable-additional-metrics"`
	Prowlarr                ProwlarrConfig `koanf:"prowlarr"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(flags *flag.FlagSet) (*Config, error)

func (*Config) LoadProwlarrFlags

func (c *Config) LoadProwlarrFlags(flags *flag.FlagSet) error

func (Config) Messages

func (c Config) Messages() map[string]string

func (Config) Translates

func (c Config) Translates() map[string]string

func (*Config) URLLabel

func (c *Config) URLLabel() string

URLLabel() exists for backwards compatibility -- prior versions built the URL in the client, meaning that the "url" metric label was missing the Port & base path that the XMLConfig provided.

func (*Config) UseBasicAuth

func (c *Config) UseBasicAuth() bool

func (*Config) UseFormAuth

func (c *Config) UseFormAuth() bool

func (*Config) Validate

func (c *Config) Validate() error

func (Config) ValidateLogLevel

func (c Config) ValidateLogLevel(val string) bool

ValidateLogLevel validates that the log level is one of the valid log levels gookit/Validate is pretty opinionated, and requires that this is not a pointer method.

type ProwlarrConfig

type ProwlarrConfig struct {
	Backfill          bool   `koanf:"backfill"`
	BackfillSinceDate string `koanf:"backfill-since-date" validate:"date"`
	BackfillSinceTime time.Time
}

func (ProwlarrConfig) Messages

func (p ProwlarrConfig) Messages() map[string]string

func (ProwlarrConfig) Translates

func (p ProwlarrConfig) Translates() map[string]string

func (ProwlarrConfig) Validate

func (p ProwlarrConfig) Validate() error

type XML

type XML struct{}

func XMLParser

func XMLParser() *XML

func (*XML) Marshal

func (p *XML) Marshal(o map[string]interface{}) ([]byte, error)

func (*XML) Merge

func (p *XML) Merge(src, dest map[string]interface{}) error

func (*XML) Unmarshal

func (p *XML) Unmarshal(b []byte) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL