config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChannelNameRequired = errors.New("channel name is required when using redis")

Functions

func NewRedisClient

func NewRedisClient(conf *RedisConfig) (redis.UniversalClient, error)

Types

type Config

type Config struct {
	LogLevel string         `envconfig:"log_level" default:"debug" yaml:"log_level,omitempty"`
	Redis    *RedisConfig   `yaml:"redis,omitempty"`
	Server   *ServerConfig  `yaml:"server,omitempty"`
	Livekit  *LivekitConfig `yaml:"livekit" validate:"required"`
}

func NewConfig

func NewConfig(path string) (*Config, error)

type LivekitConfig

type LivekitConfig struct {
	ApiKey    string `envconfig:"api_key" yaml:"api_key,omitempty" validate:"required"`
	ApiSecret string `envconfig:"api_secret" yaml:"api_secret,omitempty" validate:"required"`
}

type RedisConfig

type RedisConfig struct {
	Address             string   `envconfig:"address" yaml:"address,omitempty"`
	Username            string   `envconfig:"username" yaml:"username,omitempty"`
	Password            string   `envconfig:"password" yaml:"password,omitempty"`
	DB                  int      `envconfig:"db" yaml:"db,omitempty"`
	DialTimeout         int      `envconfig:"dial_timeout" yaml:"dial_timeout,omitempty"`
	ReadTimeout         int      `envconfig:"read_timeout" yaml:"read_timeout,omitempty"`
	WriteTimeout        int      `envconfig:"write_timeout" yaml:"write_timeout,omitempty"`
	MasterName          string   `envconfig:"sentinel_master_name" yaml:"sentinel_master_name,omitempty"`
	SentinelUsername    string   `envconfig:"sentinel_username" yaml:"sentinel_username,omitempty"`
	SentinelPassword    string   `envconfig:"sentinel_password" yaml:"sentinel_password,omitempty"`
	SentinelAddresses   []string `envconfig:"sentinel_addresses" yaml:"sentinel_addresses,omitempty"`
	ClusterAddresses    []string `envconfig:"cluster_addresses" yaml:"cluster_addresses,omitempty"`
	ClusterMaxRedirects *int     `envconfig:"cluster_max_redirects" yaml:"cluster_max_redirects,omitempty"`
	ChannelName         string   `envconfig:"channel_name" yaml:"channel_name" default:"livekit"`
}

type ServerConfig

type ServerConfig struct {
	Port            uint32   `envconfig:"port" default:"3000" yaml:"port,omitempty"`
	BindAddress     string   `envconfig:"bind_address" default:"0.0.0.0" yaml:"bind_address,omitempty"`
	TrustedUpstream []string `envconfig:"trusted_upstreams" yaml:"trusted_upstreams,omitempty"`
}

Jump to

Keyboard shortcuts

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