config

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: GPL-3.0 Imports: 11 Imported by: 2

Documentation

Overview

Package config manages the bigblueswarm config

Package config manages the bigblueswarm config

Package config manages the bigblueswarm config

Index

Constants

View Source
const ConsulPrefix string = "consul:"

ConsulPrefix is the configuration path consul prefix

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

DefaultConfigFolder is the default config folder path

Variables

This section is empty.

Functions

func ConsulKey

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

func GetConsulConfig(path string) *api.Config

GetConsulConfig returns the consul address from the path

func IsConsulEnabled

func IsConsulEnabled(path string) bool

IsConsulEnabled check if path starts with ConsulPrefix (consul:)

func SetConsulConfig added in v2.2.1

func SetConsulConfig(config *api.Config)

SetConsulConfig set the consul configuration

func WatchChanges

func WatchChanges(logger *log.Entry, 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"`
	AggregationInterval string `yaml:"aggregationInterval" json:"aggregationInterval"`
}

BalancerConfig represents the balancer configuration

func (*BalancerConfig) SetDefaultValues

func (bc *BalancerConfig) SetDefaultValues()

SetDefaultValues initialize BalancerConfig default values

type BigBlueSwarm added in v2.3.0

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

BigBlueSwarm configuration mapping

func (*BigBlueSwarm) SetDefaultValues added in v2.3.0

func (bbs *BigBlueSwarm) SetDefaultValues()

SetDefaultValues initialize BigBlueSwarm default values

type Config

type Config struct {
	BigBlueSwarm BigBlueSwarm   `yaml:"bigblueswarm" json:"bigblueswarm"`
	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

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

LoadConfigFromConsul load BigBlueSwarm configuration from consul provider

func (*Config) LoadInfluxDBConf

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

LoadInfluxDBConf load the influxdb configuration in the Config struct

func (*Config) LoadRedisConf

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 BigBlueSwarm 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