config

package
v0.0.0-...-61cf9d3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDbURL        = "B3SCALE_DB_URL"
	EnvDbPoolSize   = "B3SCALE_DB_POOL_SIZE"
	EnvLogLevel     = "B3SCALE_LOG_LEVEL"
	EnvLogFormat    = "B3SCALE_LOG_FORMAT"
	EnvListenHTTP   = "B3SCALE_LISTEN_HTTP"
	EnvReverseProxy = "B3SCALE_REVERSE_PROXY_MODE"
	EnvLoadFactor   = "B3SCALE_LOAD_FACTOR"
	EnvJWTSecret    = "B3SCALE_API_JWT_SECRET"
	EnvBBBConfig    = "BBB_CONFIG"
)

Well Known Environment Keys

View Source
const (
	EnvDbPoolSizeDefault   = "128"
	EnvDbURLDefault        = "postgres://postgres:postgres@localhost:5432/b3scale"
	EnvLogLevelDefault     = "info"
	EnvLogFormatDefault    = "structured"
	EnvListenHTTPDefault   = "127.0.0.1:42353" // :B3S
	EnvReverseProxyDefault = "false"
	EnvBBBConfigDefault    = "/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties"
	EnvLoadFactorDefault   = "1.0"
)

Defaults

Variables

View Source
var (
	// ReMatchUnsafe matches everything not a-z, A-Z, 0-9
	// minus and underscore from a string.
	ReMatchUnsafe = regexp.MustCompile(`[^a-zA-Z0-9.]`)

	// ReMatchUnderscoreSeq matches underscore sequences
	ReMatchUnderscoreSeq = regexp.MustCompile(`__+`)
)
View Source
var (
	// Version is a public global overridden at compile time
	// with the current version.
	Version string = "HEAD"

	// Build is the short commit hash
	Build string = "0000000"
)

Functions

func EnvOpt

func EnvOpt(key, fallback string) string

EnvOpt gets a configuration from the environment with a default fallback.

func GetLoadFactor

func GetLoadFactor() float64

GetLoadFactor retrievs the load factor from the environment.

func IsEnabled

func IsEnabled(value string) bool

IsEnabled returns true if the input is trueish

func LoadEnv

func LoadEnv(envfiles []string)

LoadEnv loads the environment from a file and updates the os.Environment

func SafeFilename

func SafeFilename(f string) string

SafeFilename creates an urlsafe filename by stripping unsafe characters.

func UserDirGet

func UserDirGet(filename string) ([]byte, error)

UserDirGet retrievs content from a file in the b3scale user config directory

func UserDirGetString

func UserDirGetString(filename string) (string, error)

UserDirGetString retrievs a string from a file in the b3scale user config directory

func UserDirPath

func UserDirPath(suffix string) (string, error)

UserDirPath joins the file name with the full b3scale config path

func UserDirPut

func UserDirPut(filename string, data []byte) error

UserDirPut save a file in the b3scale config directory

Types

type Backend

type Backend struct {
	Host   string
	Secret string
}

Backend is the configuration of a cluster node

func NewBackend

func NewBackend(host, secret string) *Backend

NewBackend creates a new Backend configuration and normalizes the Host url

type BackendsConfig

type BackendsConfig interface {
	Load() ([]*Backend, error)
}

BackendsConfig interface

type Frontend

type Frontend struct {
	Key    string
	Secret string
}

Frontend is the configuration of a a cluster consumer.

func NewFrontend

func NewFrontend(key, secret string) *Frontend

NewFrontend creates a new frontend config

type FrontendsConfig

type FrontendsConfig interface {
	Load() ([]*Frontend, error)
}

FrontendsConfig interface

type Properties

type Properties map[string]string

Properties is a map of BBB properties. The map stores the raw data. Retriving values should be done through the accessor which will resolve refs.

func ReadPropertiesFile

func ReadPropertiesFile(filename string) (Properties, error)

ReadPropertiesFile consumes a BBB properties file

func (Properties) Get

func (p Properties) Get(key string) (string, bool)

Get retrievs a value from the properties map and will resolve a reference.

Jump to

Keyboard shortcuts

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