config

package
v1.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvBBBConfig = "BBB_CONFIG"

	EnvDbURL      = "B3SCALE_DB_URL"
	EnvDbPoolSize = "B3SCALE_DB_POOL_SIZE"

	EnvCmdWorkerPoolSize = "B3SCALE_CMD_WORKER_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"
	EnvAPIURL         = "B3SCALE_API_URL"
	EnvAPIAccessToken = "B3SCALE_API_ACCESS_TOKEN"

	EnvRecordingsInboxPath         = "B3SCALE_RECORDINGS_INBOX_PATH"
	EnvRecordingsPublishedPath     = "B3SCALE_RECORDINGS_PUBLISHED_PATH"
	EnvRecordingsUnpublishedPath   = "B3SCALE_RECORDINGS_UNPUBLISHED_PATH"
	EnvRecordingsPlaybackHost      = "B3SCALE_RECORDINGS_PLAYBACK_HOST"
	EnvRecordingsDefaultVisibility = "B3SCALE_RECORDINGS_DEFAULT_VISIBILITY"

	EnvHTTPRequestTimeout    = "B3SCALE_HTTP_REQUEST_TIMEOUT"
	EnvHTTPReadHeaderTimeout = "B3SCALE_HTTP_READ_HEADER_TIMEOUT"
	EnvHTTPWriteTimeout      = "B3SCALE_HTTP_WRITE_TIMEOUT"
	EnvHTTPIdleTimeout       = "B3SCALE_HTTP_IDLE_TIMEOUT"
)

Well Known Environment Keys

View Source
const (
	EnvBBBConfigDefault = "/etc/bigbluebutton/bbb-web.properties"

	EnvDbPoolSizeDefault = "128"
	EnvDbURLDefault      = "postgres://postgres:postgres@localhost:5432/b3scale"

	EnvCmdWorkerPoolSizeDefault = "16"

	EnvLogLevelDefault  = "info"
	EnvLogFormatDefault = "structured"

	EnvReverseProxyDefault = "false"
	EnvLoadFactorDefault   = "1.0"

	EnvRecordingsDefaultVisibilityDefault = "published"

	EnvListenHTTPDefault = "127.0.0.1:42353" // :B3S

	// HTTP timeout defaults (in seconds)
	EnvHTTPRequestTimeoutDefault    = "60"
	EnvHTTPReadHeaderTimeoutDefault = "5"
	EnvHTTPWriteTimeoutDefault      = "60"
	EnvHTTPIdleTimeoutDefault       = "120"
)

Defaults

Variables

View Source
var (
	// ReMatchUnsafe matches everything not a-z, A-Z, 0-9
	// and '.' 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 CheckEnv added in v1.1.1

func CheckEnv() error

CheckEnv checks if the environment is configured

func DomainOf added in v1.1.0

func DomainOf(addr string) string

DomainOf returns the domain name (with TLD) of the given address or URL. FIXME: This feels out of place here.

func EnvOpt

func EnvOpt(key, fallback string) string

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

func GetCmdWorkerPoolSize

func GetCmdWorkerPoolSize() int

GetCmdWorkerPoolSize returns number of workers processing background tasks.

func GetEnvOpt

func GetEnvOpt(key string) (string, bool)

GetEnvOpt gets a configuration from the environment, but will fail if the variable is not present.

func GetHTTPIdleTimeout

func GetHTTPIdleTimeout() time.Duration

GetHTTPIdleTimeout returns the HTTP idle timeout.

func GetHTTPReadHeaderTimeout

func GetHTTPReadHeaderTimeout() time.Duration

GetHTTPReadHeaderTimeout returns the HTTP read header timeout.

func GetHTTPRequestTimeout

func GetHTTPRequestTimeout() time.Duration

GetHTTPRequestTimeout returns the HTTP request timeout.

func GetHTTPWriteTimeout

func GetHTTPWriteTimeout() time.Duration

GetHTTPWriteTimeout returns the HTTP write timeout.

func GetLoadFactor

func GetLoadFactor() float64

GetLoadFactor retrievs the load factor from the environment.

func GetLoggingOpts

func GetLoggingOpts() *logging.Options

GetLoggingOpts returns the logging options with log level and format.

func GetRecordingsDefaultVisibility added in v1.3.0

func GetRecordingsDefaultVisibility() bbb.RecordingVisibility

GetRecordingsDefaultVisibility returns the parsed default visibility from the environment.

This function will never panic: CheckEnv will ensure that the configured value is valid. Make sure CheckEnv is invoked prior to using this function.

func GetRecordingsInboxPath added in v1.3.0

func GetRecordingsInboxPath() string

GetRecordingsInboxPath returns the configured inbox path. If the environment variable is not set, either the published or unpublished path will be returned depending on the default visibility.

func GetRecordingsPublishedPath added in v1.3.0

func GetRecordingsPublishedPath() string

GetRecordingsPublishedPath returns the configured published path.

func GetRecordingsUnpublishedPath added in v1.3.0

func GetRecordingsUnpublishedPath() string

GetRecordingsUnpublishedPath returns the configured path to unpublished recordings.

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 MustEnv added in v1.1.0

func MustEnv(key string) string

MustEnv gets a configuration from the environment and will panic if the variable is empty.

func SafeFilename

func SafeFilename(f string) string

SafeFilename creates an urlsafe filename by stripping unsafe characters.

func UserDirFilename

func UserDirFilename(filename string) (string, error)

UserDirFilename gets the full path to a filename in the userdir

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 ConnectOpts

type ConnectOpts struct {
	URL      string
	MaxConns int32
	MinConns int32
}

ConnectOpts database connection options

func GetDbConnectOpts

func GetDbConnectOpts() *ConnectOpts

GetDbConnectOpts return the database configuration from the environment.

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