config

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ConsulPrefix string = "consul:"

ConsulPrefix is the configuration path consul prefix

View Source
const DefaultConfigFolder = "$HOME/.b3lb"

DefaultConfigFolder is the default config folder path

Variables

This section is empty.

Functions

func ConsulKey added in v2.1.2

func ConsulKey(conf string) string

ConsulKey return the consul key from the configuration name

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath return the default config path file

func FormalizeConfigPath

func FormalizeConfigPath(path string) (string, error)

FormalizeConfigPath formalize config path. If config path is the default config path (home directory), it returns a computed path

func GetConsulConfig added in v2.1.2

func GetConsulConfig(path string) *api.Config

GetConsulConfig returns the consul address from the path

func IsConsulEnabled added in v2.1.2

func IsConsulEnabled(path string) bool

IsConsulEnabled check if path starts with ConsulPrefix (consul:)

func Path added in v2.1.0

func Path() string

Path return the flag config path

func WatchChanges added in v2.1.0

func WatchChanges(key string, handler func(value []byte)) error

WatchChanges watch consul changes and execute handler on changes

Types

type AdminConfig

type AdminConfig struct {
	APIKey string `yaml:"apiKey" json:"apiKey"`
}

AdminConfig represents the admin configuration

type BalancerConfig

type BalancerConfig struct {
	MetricsRange string `yaml:"metricsRange" json:"metricsRange"`
	CPULimit     int    `yaml:"cpuLimit" json:"cpuLimit"`
	MemLimit     int    `yaml:"memLimit" json:"memLimit"`
}

BalancerConfig represents the balancer configuration

func (*BalancerConfig) SetDefaultValues

func (bc *BalancerConfig) SetDefaultValues()

SetDefaultValues initialize BalancerConfig default values

type BigBlueButton

type BigBlueButton struct {
	Secret                 string `yaml:"secret" json:"secret"`
	RecordingsPollInterval string `yaml:"recordingsPollInterval" json:"recordingsPollInterval"`
}

BigBlueButton configuration mapping

type Config

type Config struct {
	BigBlueButton BigBlueButton  `yaml:"bigbluebutton" json:"bigbluebutton"`
	Admin         AdminConfig    `yaml:"admin" json:"admin"`
	Balancer      BalancerConfig `yaml:"balancer" json:"balancer"`
	Port          Port           `yaml:"port" json:"port"`
	RDB           RDB            `yaml:"redis" json:"redis"`
	IDB           IDB            `yaml:"influxdb" json:"influxdb"`
}

Config represents main configuration mapping

func Load

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

Load the configuration from the given path

func LoadConfigFromConsul added in v2.1.2

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

LoadConfigFromConsul load B3LB configuration from consul provider

func (*Config) LoadInfluxDBConf added in v2.1.2

func (c *Config) LoadInfluxDBConf(kv *api.KV) error

LoadInfluxDBConf load the influxdb configuration in the Config struct

func (*Config) LoadRedisConf added in v2.1.2

func (c *Config) LoadRedisConf(kv *api.KV) error

LoadRedisConf load the redis configuration in the Config struct

type IDB

type IDB struct {
	Address      string `yaml:"address" json:"address"`
	Token        string `yaml:"token" json:"token"`
	Organization string `yaml:"organization" json:"organization"`
	Bucket       string `yaml:"bucket" json:"bucket"`
}

IDB represents influxdb database configuration mapping

type Port

type Port int

Port represents the B3LB port configuration

type RDB

type RDB struct {
	Address  string `yaml:"address" json:"address"`
	Password string `yaml:"password" json:"password"`
	DB       int    `yaml:"database" json:"database"`
}

RDB represents redis database configuration mapping

Jump to

Keyboard shortcuts

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