config

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: GPL-3.0 Imports: 16 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:":5050" split_words:"true"`
	Secret                []byte `split_words:"true"`
	SessionTimeoutSeconds int    `default:"0" split_words:"true"`

	TurnAddress   string `default:":3478" required:"true" split_words:"true"`
	TurnPortRange string `split_words:"true"`

	TurnExternalIP     []string `split_words:"true"`
	TurnExternalPort   string   `default:"3478" split_words:"true"`
	TurnExternalSecret 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:"-"`
	TurnExternal   bool              `ignored:"true"`
	TurnIPProvider ipdns.Provider    `ignored:"true"`
	TurnPort       string            `ignored:"true"`

	CloseRoomWhenOwnerLeaves bool `default:"true" split_words:"true"`
}

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