config

package
v0.0.0-...-fcbdc9d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFlagSet

func GetFlagSet() *pflag.FlagSet

Types

type BuntDBConfig

type BuntDBConfig struct {
	GlobalName       string `mapstructure:"global_name"`
	RoomNameTemplate string `mapstructure:"room_name_template"`
}

BundDBConfig configures the BuntDB file storage backed database.

type Config

type Config struct {
	HistoryConfig     HistoryConfig     `mapstructure:"history"`
	OIDCConfigs       []OIDCConfig      `mapstructure:"oidc"`
	PersistenceConfig PersistenceConfig `mapstructure:"persistence"`
	PluginConfigs     []PluginConfig    `mapstructure:"plugin"`
	LogLevel          string            `mapstructure:"log_level"`
	AdminUser         string            `mapstructure:"admin_user"`
}

Config is the global configuration object which is filled via the configuration file (TODO: possibly command-line options in the future, consider using viper)

func ReadConfiguration

func ReadConfiguration(configPath string, flagSet *pflag.FlagSet) (*Config, error)

ReadConfiguration reads and parses the configuration located at configPath, which can either point to a single TOML file or to a directory, in which case all *.toml files in this directory are concatenated. It returns a Config object.

type HistoryConfig

type HistoryConfig struct {
	HistorySize int `mapstructure:"history_size"`
}

HistoryConfig configures the size of the immediate event history that is kept in memory in a ring buffer and sent to newly connected clients

type OIDCConfig

type OIDCConfig struct {
	Name        string `mapstructure:"name"`
	ClientId    string `mapstructure:"client_id"`
	ProviderUrl string `mapstructure:"provider_url"` // f.e. "https://accounts.google.com", this is used to construct the discovery url and subsequently discover the openid endpoints
}

An OIDCConfig object configures an OpenID Connect provider that is used to authenticate users. Users provide an ID token and the name of the provider, the authentication is then performed via verification of the token.

type PersistenceConfig

type PersistenceConfig struct {
	Type string `mapstructure:"type"`
	DSN  string `mapstructure:"dsn"`

	FlockPath      string         `mapstructure:"flock_path"` // deprecated
	BuntDBConfig   BuntDBConfig   `mapstructure:"buntdb"`     // deprecated
	SQLiteConfig   SQLiteConfig   `mapstructure:"sqlite"`     // deprecated
	PostgresConfig PostgresConfig `mapstructure:"postgres"`   // deprecated
}

PersistenceConfig configures the persistence backends. Currently only BuntDB via BuntDBConfig and SQLite via SQLiteConfig are supported. If more than one persister is defined, sqlite > buntdb.

type PluginConfig

type PluginConfig struct {
	Name            string                 `mapstructure:"name"`
	RawPluginConfig map[string]interface{} `mapstructure:",remain"`
}

Each named PluginConfig block configures a plugin. The raw configuration RawPluginConfig is passed on to the plugin which parses its own configuration.

type PostgresConfig

type PostgresConfig struct {
	DSN string `mapstructure:"dsn"`
}

type SQLiteConfig

type SQLiteConfig struct {
	DSN string `mapstructure:"dsn"`
}

Jump to

Keyboard shortcuts

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