Documentation ¶
Index ¶
Constants ¶
const ( Title = "DiscordNotifier Client" DefaultName = "discordnotifier-client" DefaultLogFileMb = 100 DefaultLogFiles = 0 // delete none DefaultTimeout = time.Minute DefaultBindAddr = "0.0.0.0:5454" DefaultEnvPrefix = "DN" )
Application Defaults.
Variables ¶
var ( ErrNilAPIKey = fmt.Errorf("API key may not be empty") ErrNoApps = fmt.Errorf("0 applications configured") )
Errors returned by this package.
var ( ErrNoTMDB = fmt.Errorf("TMDB ID must not be empty") ErrNoGRID = fmt.Errorf("GRID ID must not be empty") ErrNoTVDB = fmt.Errorf("TVDB ID must not be empty") ErrNoMBID = fmt.Errorf("MBID ID must not be empty") ErrNoRadarr = fmt.Errorf("configured radarr ID not found") ErrNoSonarr = fmt.Errorf("configured sonarr ID not found") ErrNoLidarr = fmt.Errorf("configured lidarr ID not found") ErrNoReadarr = fmt.Errorf("configured readarr ID not found") ErrExists = fmt.Errorf("the requested item already exists") )
Errors sent to client web requests.
Functions ¶
Types ¶
type Client ¶
type Client struct { *Logger Flags *Flags Config *Config // contains filtered or unexported fields }
Client stores all the running data.
func NewDefaults ¶
func NewDefaults() *Client
NewDefaults returns a new Client pointer with default settings.
func (*Client) InitStartup ¶
func (c *Client) InitStartup()
InitStartup fixes config problems and prints info about our startup config. This runs once on startup.
func (*Client) RestartWebServer ¶ added in v0.0.2
func (c *Client) RestartWebServer(run func())
RestartWebServer stop and starts the web server. Panics if that causes an error or timeout.
func (*Client) SetupLogging ¶
func (c *Client) SetupLogging()
SetupLogging splits log write into a file and/or stdout.
func (*Client) StartWebServer ¶ added in v0.0.2
func (c *Client) StartWebServer()
StartWebServer starts the web server.
func (*Client) StopWebServer ¶ added in v0.0.2
func (c *Client) StopWebServer()
StopWebServer stops the web servers. Panics if that causes an error or timeout.
type Config ¶
type Config struct { APIKey string `json:"api_key" toml:"api_key" xml:"api_key" yaml:"api_key"` BindAddr string `json:"bind_addr" toml:"bind_addr" xml:"bind_addr" yaml:"bind_addr"` SSLCrtFile string `json:"ssl_cert_file" toml:"ssl_cert_file" xml:"ssl_cert_file" yaml:"ssl_cert_file"` SSLKeyFile string `json:"ssl_key_file" toml:"ssl_key_file" xml:"ssl_key_file" yaml:"ssl_key_file"` Quiet bool `json:"quiet" toml:"quiet" xml:"quiet" yaml:"quiet"` LogFile string `json:"log_file" toml:"log_file" xml:"log_file" yaml:"log_file"` HTTPLog string `json:"http_log" toml:"http_log" xml:"http_log" yaml:"http_log"` LogFiles int `json:"log_files" toml:"log_files" xml:"log_files" yaml:"log_files"` LogFileMb int `json:"log_file_mb" toml:"log_file_mb" xml:"log_file_mb" yaml:"log_file_mb"` URLBase string `json:"urlbase" toml:"urlbase" xml:"urlbase" yaml:"urlbase"` Upstreams []string `json:"upstreams" toml:"upstreams" xml:"upstreams" yaml:"upstreams"` Timeout cnfg.Duration `json:"timeout" toml:"timeout" xml:"timeout" yaml:"timeout"` Sonarr []*SonarrConfig `json:"sonarr,omitempty" toml:"sonarr" xml:"sonarr" yaml:"sonarr,omitempty"` Radarr []*RadarrConfig `json:"radarr,omitempty" toml:"radarr" xml:"radarr" yaml:"radarr,omitempty"` Lidarr []*LidarrConfig `json:"lidarr,omitempty" toml:"lidarr" xml:"lidarr" yaml:"lidarr,omitempty"` Readarr []*ReadarrConfig `json:"readarr,omitempty" toml:"readarr" xml:"readarr" yaml:"readarr,omitempty"` }
Config represents the data in our config file.
type Flags ¶
type Flags struct { *flag.FlagSet ConfigFile string EnvPrefix string // contains filtered or unexported fields }
Flags are our CLI input flags.
type LidarrConfig ¶
type LidarrConfig struct { *starr.Config *lidarr.Lidarr sync.RWMutex `json:"-" toml:"-" xml:"-" yaml:"-"` }
LidarrConfig represents the input data for a Lidarr server.
type Logger ¶
type Logger struct { Errors *log.Logger // Shares a Writer with Logger. Logger *log.Logger Requests *log.Logger // contains filtered or unexported fields }
Logger provides a struct we can pass into other packages.
type RadarrConfig ¶
type RadarrConfig struct { *starr.Config *radarr.Radarr sync.RWMutex `json:"-" toml:"-" xml:"-" yaml:"-"` }
RadarrConfig represents the input data for a Radarr server.