configfile

package
v0.1.5-b1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout  = time.Minute
	DefaultBindAddr = "0.0.0.0:5454"
)

Application Defaults.

View Source
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

View Source
var Template = template.Must(template.New("config").Funcs(Funcs()).Parse(tmpl))

Template is the config file template. nolint: gochecknoglobals

Functions

func Funcs

func Funcs() template.FuncMap

Types

type AllowedIPs

type AllowedIPs []*net.IPNet

AllowedIPs determines who can set x-forwarded-for.

func (AllowedIPs) Contains

func (n AllowedIPs) Contains(ip string) bool

func (AllowedIPs) String

func (n AllowedIPs) String() (s string)

String turns a list of allowedIPs into a printable masterpiece.

type Config

type Config struct {
	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"`
	AutoUpdate string              `json:"auto_update" toml:"auto_update" xml:"auto_update" yaml:"auto_update"`
	Upstreams  []string            `json:"upstreams" toml:"upstreams" xml:"upstreams" yaml:"upstreams"`
	Timeout    cnfg.Duration       `json:"timeout" toml:"timeout" xml:"timeout" yaml:"timeout"`
	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"`
	*logs.Logs
	*apps.Apps
	Allow AllowedIPs `json:"-" toml:"-" xml:"-" yaml:"-"`
}

Config represents the data in our config file.

func (*Config) FindAndReturn

func (c *Config) FindAndReturn(configFile string, write bool) (string, bool, string)

FindAndReturn return a config file. Write one if requested.

func (*Config) Get

func (c *Config) Get(configFile, envPrefix string) error

Get parses a config file and environment variables. Sometimes the app runs without a config file entirely.

func (*Config) Write

func (c *Config) Write(file string) (string, error)

Write config to a file.

Jump to

Keyboard shortcuts

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