config

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthModeTurn = "turn"
	AuthModeAll  = "all"
	AuthModeNone = "none"
)

Variables

This section is empty.

Functions

func Get

func Get() (Config, []FutureLog)

Get loads the application config.

Types

type Config

type Config struct {
	LogLevel LogLevel `default:"info" split_words:"true"`

	ExternalIP string `split_words:"true"`

	TLSCertFile string `split_words:"true"`
	TLSKeyFile  string `split_words:"true"`

	ServerTLS     bool   `split_words:"true"`
	ServerAddress string `default:"0.0.0.0:5050" split_words:"true"`
	Secret        []byte `split_words:"true"`

	TurnAddress    string `default:"0.0.0.0:3478" required:"true" split_words:"true"`
	TurnStrictAuth bool   `default:"true" split_words:"true"`
	TurnPortRange  string `split_words:"true"`

	TrustProxyHeaders  bool     `split_words:"true"`
	AuthMode           string   `default:"turn" split_words:"true"`
	CorsAllowedOrigins []string `split_words:"true"`
	UsersFile          string   `split_words:"true"`
	Prometheus         bool     `split_words:"true"`

	CheckOrigin func(string) bool `ignored:"true" json:"-"`
}

Config represents the application configuration.

func (Config) PortRange added in v1.0.7

func (c Config) PortRange() (uint16, uint16, bool)

type FutureLog

type FutureLog struct {
	Level zerolog.Level
	Msg   string
}

FutureLog is an intermediate type for log messages. It is used before the config was loaded because without loaded config we do not know the log level, so we log these messages once the config was initialized.

type LogLevel

type LogLevel zerolog.Level

LogLevel type that provides helper methods for decoding.

func (LogLevel) AsZeroLogLevel

func (ll LogLevel) AsZeroLogLevel() zerolog.Level

AsZeroLogLevel converts the LogLevel to a zerolog.Level.

func (*LogLevel) Decode

func (ll *LogLevel) Decode(value string) error

Decode decodes a string to a log level.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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