Documentation
¶
Overview ¶
Package configfile handles all the base configuration-file routines. This package also holds the conifiguration for the webserver and notifiarr packages. In here you will find config file parsing, validation, and creation. The application can re-write its own config file from a built-in template, complete with comments. In some circumstances the application writes a brand new empty config on startup.
Index ¶
Constants ¶
const ( MsgNoConfigFile = "Using env variables only. Config file not found." MsgConfigFailed = "Using env variables only. Could not create config file: " MsgConfigCreate = "Created new config file: " MsgConfigFound = "Using Config File: " )
Return prefixes from FindAndReturn.
Variables ¶
var ForceAllTmpl = false // nolint:gochecknoglobals
ForceAllTmpl allows you to force some specific settings. Used to build a default template.
Template is the config file template. nolint: gochecknoglobals
Functions ¶
func CheckPort ¶ added in v0.2.0
CheckPort attempts to bind to a port to check if it's in use or not. We use this to check the port before starting the webserver.
Types ¶
type AllowedIPs ¶
AllowedIPs determines who can set x-forwarded-for.
func MakeIPs ¶ added in v0.1.15
func MakeIPs(upstreams []string) (a AllowedIPs)
MakeIPs turns a list of CIDR strings (or plain IPs) into a list of net.IPNet. This "allowed" list is later used to check incoming IPs from web requests.
func (AllowedIPs) Contains ¶
func (n AllowedIPs) Contains(ip string) bool
Contains returns true if an IP is allowed.
func (AllowedIPs) String ¶
func (n AllowedIPs) String() (s string)
String turns a list of allowedIPs into a printable masterpiece.
type Config ¶
type Config struct { UIPassword CryptPass `json:"uiPassword" toml:"ui_password" xml:"ui_password" yaml:"uiPassword"` BindAddr string `json:"bindAddr" toml:"bind_addr" xml:"bind_addr" yaml:"bindAddr"` SSLCrtFile string `json:"sslCertFile" toml:"ssl_cert_file" xml:"ssl_cert_file" yaml:"sslCertFile"` SSLKeyFile string `json:"sslKeyFile" toml:"ssl_key_file" xml:"ssl_key_file" yaml:"sslKeyFile"` AutoUpdate string `json:"autoUpdate" toml:"auto_update" xml:"auto_update" yaml:"autoUpdate"` MaxBody int `json:"maxBody" toml:"max_body" xml:"max_body" yaml:"maxBody"` Mode string `json:"mode" toml:"mode" xml:"mode" yaml:"mode"` Upstreams []string `json:"upstreams" toml:"upstreams" xml:"upstreams" yaml:"upstreams"` Timeout cnfg.Duration `json:"timeout" toml:"timeout" xml:"timeout" yaml:"timeout"` Serial bool `json:"serial" toml:"serial" xml:"serial" yaml:"serial"` Retries int `json:"retries" toml:"retries" xml:"retries" yaml:"retries"` Plex *plex.Server `json:"plex" toml:"plex" xml:"plex" yaml:"plex"` Snapshot *snapshot.Config `json:"snapshot" toml:"snapshot" xml:"snapshot" yaml:"snapshot"` Services *services.Config `json:"services" toml:"services" xml:"services" yaml:"services"` Service []*services.Service `json:"service" toml:"service" xml:"service" yaml:"service"` EnableApt bool `json:"apt" toml:"apt" xml:"apt" yaml:"apt"` *logs.LogConfig *apps.Apps Allow AllowedIPs `json:"-" toml:"-" xml:"-" yaml:"-"` }
Config represents the data in our config file.
func NewConfig ¶ added in v0.2.0
NewConfig returns a fresh config with only defaults and a logger ready to go.
func (*Config) CopyConfig ¶ added in v0.3.0
CopyConfig returns a copy of the configuration data. Useful for writing a config file with different values than what's running.
func (*Config) FindAndReturn ¶
FindAndReturn return a config file. Write one if requested.
type CryptPass ¶ added in v0.3.0
type CryptPass string
CryptPass allows us to validate an input password easily.
func (CryptPass) IsCrypted ¶ added in v0.3.0
IsCrypted checks if a password string is already encrypted.
type Flags ¶ added in v0.1.14
type Flags struct { *flag.FlagSet `json:"-"` VerReq bool `json:"verReq"` Restart bool `json:"restart"` AptHook bool `json:"aptHook"` Updated bool `json:"updated"` PSlist bool `json:"pslist"` Write string `json:"wrte"` Curl string `json:"curl"` ConfigFile string `json:"configFile"` ExtraConf []string `json:"extraConf"` EnvPrefix string `json:"envPrefix"` Headers []string `json:"headers"` Assets string `json:"staticDif"` }
Flags are our CLI input flags.