config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT-0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Hostname string `yaml:"hostname"`
	Smtp     struct {
		Host       string `yaml:"host"`
		Port       int    `yaml:"port"`
		Validation struct {
			MaximumLineLength int `yaml:"maximum_line_length"`
			MaximumReceivers  int `yaml:"maximum_receivers"`
		} `yaml:"validation"`
	} `yaml:"smtp"`
	Http struct {
		Host         string `yaml:"host"`
		Port         int    `yaml:"port"`
		Path         string `yaml:"path"`
		AllowOrigins string `yaml:"allow_origins"`
		AssetsRoot   string `yaml:"assets_root"`
		BaseUrl      string `yaml:"base_url"`
		// TODO: error after long time server run. Error still not fixed
		Websocket bool `yaml:"websocket"`
	} `yaml:"http"`
	Websocket struct {
		MaxConnection int `yaml:"max_connection"`
	} `yaml:"websocket"`
	Storage struct {
		Use          string `yaml:"use"`
		PerRoomLimit int    `yaml:"per_room_limit"`
		Directory    struct {
			Path string `yaml:"path"`
		} `yaml:"directory"`
		MongoDB struct {
			Connection string `yaml:"connection"`
			Collection string `yaml:"collection"`
		} `yaml:"mongodb"`
	} `yaml:"storage"`
	Authentication struct {
		Use      string `yaml:"use"`
		Type     string `yaml:"type"`
		Admin    string `yaml:"admin"`
		Internal struct {
			HmacSecret []byte
			// Lifetime in minutes
			SessionLifetime int64 `yaml:"session_lifetime"`
		} `yaml:"internal"`

		File struct {
			Path string `yaml:"path"`
		} `yaml:"file"`
		MongoDB struct {
			Connection string `yaml:"connection"`
			Collection string `yaml:"collection"`
		} `yaml:"mongodb"`
	} `yaml:"authentication"`
	Sharing struct {
		Use string `yaml:"use"`
		CSV struct {
			Path string `yaml:"path"`
		} `yaml:"csv"`
		MongoDB struct {
			Connection string `yaml:"connection"`
			Collection string `yaml:"collection"`
		} `yaml:"mongodb"`
	} `yaml:"sharing"`
	UI struct {
		File string `yaml:"file"`
	} `yaml:"ui"`
	DB  DbConfig `yaml:"db"`
	Log struct {
		Level string `yaml:"level"`
	} `yaml:"log"`
}

func ParseConfig

func ParseConfig(filePath string) *AppConfig

func (*AppConfig) IsAdmin added in v1.0.17

func (config *AppConfig) IsAdmin(username string) bool

type DbConfig added in v1.0.16

type DbConfig struct {
	Connections map[string]map[string]interface{} `yaml:"connections"`
}

func (*DbConfig) GetMongoDBConnection added in v1.0.16

func (dbConfig *DbConfig) GetMongoDBConnection(connectionName string) *mongo.Database

Jump to

Keyboard shortcuts

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