Documentation
¶
Index ¶
- Constants
- Variables
- func CheckEnv() error
- func DomainOf(addr string) string
- func EnvOpt(key, fallback string) string
- func GetEnvOpt(key string) (string, bool)
- func GetLoadFactor() float64
- func GetRecordingsDefaultVisibility() bbb.RecordingVisibility
- func GetRecordingsInboxPath() string
- func GetRecordingsPublishedPath() string
- func GetRecordingsUnpublishedPath() string
- func IsEnabled(value string) bool
- func LoadEnv(envfiles []string)
- func MustEnv(key string) string
- func SafeFilename(f string) string
- func UserDirFilename(filename string) (string, error)
- func UserDirGet(filename string) ([]byte, error)
- func UserDirGetString(filename string) (string, error)
- func UserDirPath(suffix string) (string, error)
- func UserDirPut(filename string, data []byte) error
- type Properties
Constants ¶
const ( EnvBBBConfig = "BBB_CONFIG" 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" 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" )
Well Known Environment Keys
const ( EnvBBBConfigDefault = "/etc/bigbluebutton/bbb-web.properties" EnvDbPoolSizeDefault = "128" EnvDbURLDefault = "postgres://postgres:postgres@localhost:5432/b3scale" EnvLogLevelDefault = "info" EnvLogFormatDefault = "structured" EnvListenHTTPDefault = "127.0.0.1:42353" // :B3S EnvReverseProxyDefault = "false" EnvLoadFactorDefault = "1.0" EnvRecordingsDefaultVisibilityDefault = "published" )
Defaults
Variables ¶
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(`__+`) )
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
DomainOf returns the domain name (with TLD) of the given address or URL. FIXME: This feels out of place here.
func GetEnvOpt ¶
GetEnvOpt gets a configuration from the environment, but will fail if the variable is not present.
func GetLoadFactor ¶
func GetLoadFactor() float64
GetLoadFactor retrievs the load factor from the environment.
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 LoadEnv ¶
func LoadEnv(envfiles []string)
LoadEnv loads the environment from a file and updates the os.Environment
func MustEnv ¶ added in v1.1.0
MustEnv gets a configuration from the environment and will panic if the variable is empty.
func SafeFilename ¶
SafeFilename creates an urlsafe filename by stripping unsafe characters.
func UserDirFilename ¶
UserDirFilename gets the full path to a filename in the userdir
func UserDirGet ¶
UserDirGet retrievs content from a file in the b3scale user config directory
func UserDirGetString ¶
UserDirGetString retrievs a string from a file in the b3scale user config directory
func UserDirPath ¶
UserDirPath joins the file name with the full b3scale config path
func UserDirPut ¶
UserDirPut save a file in the b3scale config directory
Types ¶
type Properties ¶
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