config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDefaultLogger

func InitDefaultLogger()

Types

type AuthConfig

type AuthConfig struct {
	Session      SessionConfig          `yaml:"session" envPrefix:"SESSION_"`
	TOTP         TOTPConfig             `yaml:"totp"    envPrefix:"TOTP_"`
	ReverseProxy ReverseProxyAuthConfig `yaml:"reverse_proxy" envPrefix:"REVERSE_PROXY_"`
}

type Config

type Config struct {
	Server    ServerConfig    `yaml:"server"    envPrefix:"SERVER_"`
	Tvheadend TvheadendConfig `yaml:"tvheadend" envPrefix:"TVHEADEND_"`
	Auth      AuthConfig      `yaml:"auth"      envPrefix:"AUTH_"`
	Database  DatabaseConfig  `yaml:"database"  envPrefix:"DATABASE_"`
	Metrics   MetricsConfig   `yaml:"metrics"  envPrefix:"METRICS_"`
	Log       LogConfig       `yaml:"log" envPrefix:"LOG_"`
}

func Load

func Load() (*Config, error)

Load loads a config from a config file at a given path and overrides from environment variables.

type DatabaseConfig

type DatabaseConfig struct {
	Path string `yaml:"path" env:"PATH"`
}

func (*DatabaseConfig) SetDefaults

func (c *DatabaseConfig) SetDefaults()

type LogConfig

type LogConfig struct {
	Level  string `yaml:"level" env:"LEVEL"`
	Format string `yaml:"format" env:"FORMAT"`
}

func (*LogConfig) SetDefaults

func (c *LogConfig) SetDefaults()

func (*LogConfig) SetupLogger

func (c *LogConfig) SetupLogger()

type MetricsConfig

type MetricsConfig struct {
	Enabled bool   `yaml:"enabled" env:"ENABLED"`
	Path    string `yaml:"path" env:"PATH"`
	Port    int    `yaml:"port" env:"PORT"`
	Host    string `yaml:"host" env:"HOST"`
	Token   string `yaml:"token" env:"TOKEN"`
}

func (*MetricsConfig) Addr

func (c *MetricsConfig) Addr() string

func (*MetricsConfig) SetDefaults

func (c *MetricsConfig) SetDefaults()

type ReverseProxyAuthConfig

type ReverseProxyAuthConfig struct {
	Enabled           bool     `yaml:"enabled"     env:"ENABLED"`
	UserHeader        string   `yaml:"user_header" env:"USER_HEADER"`
	EmailHeader       string   `yaml:"email_header" env:"EMAIL_HEADER"`
	NameHeader        string   `yaml:"name_header" env:"NAME_HEADER"`
	AllowedProxies    []string `yaml:"allowed_proxies" env:"ALLOWED_PROXIES"`
	AllowRegistration bool     `yaml:"allow_registration" env:"ALLOW_REGISTRATION"`
}

func (*ReverseProxyAuthConfig) SetDefaults

func (c *ReverseProxyAuthConfig) SetDefaults()

type ServerConfig

type ServerConfig struct {
	Host string `yaml:"host" env:"HOST"`
	Port int    `yaml:"port" env:"PORT"`
}

func (*ServerConfig) Addr

func (c *ServerConfig) Addr() string

func (*ServerConfig) SetDefaults

func (c *ServerConfig) SetDefaults()

type SessionConfig

type SessionConfig struct {
	CookieName              string        `yaml:"cookie_name"               env:"COOKIE_NAME"`
	CookieSecure            bool          `yaml:"cookie_secure"             env:"COOKIE_SECURE"`
	MaximumInactiveLifetime time.Duration `yaml:"maximum_inactive_lifetime" env:"MAXIMUM_INACTIVE_LIFETIME"`
	MaximumLifetime         time.Duration `yaml:"maximum_lifetime"          env:"MAXIMUM_LIFETIME"`
	TokenRotationInterval   time.Duration `yaml:"token_rotation_interval"   env:"TOKEN_ROTATION_INTERVAL"`
	CleanupInterval         time.Duration `yaml:"cleanup_interval"          env:"CLEANUP_INTERVAL"`
}

func (*SessionConfig) SetDefaults

func (s *SessionConfig) SetDefaults()

type TOTPConfig

type TOTPConfig struct {
	Issuer string `yaml:"issuer" env:"ISSUER"`
}

func (*TOTPConfig) SetDefaults

func (c *TOTPConfig) SetDefaults()

type TvheadendConfig

type TvheadendConfig struct {
	Scheme   string `yaml:"scheme"   env:"SCHEME"`
	Host     string `yaml:"host"     env:"HOST"`
	Port     int    `yaml:"port"     env:"PORT"`
	Username string `yaml:"username" env:"USERNAME"`
	Password string `yaml:"password" env:"PASSWORD,unset"`
}

func (*TvheadendConfig) SetDefaults

func (c *TvheadendConfig) SetDefaults()

func (*TvheadendConfig) URL

func (c *TvheadendConfig) URL() string

func (*TvheadendConfig) Validate

func (c *TvheadendConfig) Validate() error

Jump to

Keyboard shortcuts

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