config

package
v0.0.0-...-0b5a9a0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Hostname    string `env:"HOSTNAME,required"`
	Development bool   `env:"DEVELOPMENT,default=False"`
	LogLevel    string // Set only from the CLI flag
	Database    *DatabaseConfig
	Storage     *StorageConfig
	Http        *HttpConfig
}

func ParseServerConfiguration

func ParseServerConfiguration(ctx context.Context, logger *logrus.Logger) *Config

ParseServerConfiguration parses the configuration from the enabled lookupers

func (*Config) DebugConfiguration

func (c *Config) DebugConfiguration(logger *logrus.Logger)

func (Config) SetDefaults

func (c Config) SetDefaults(logger *logrus.Logger, portableMode bool)

SetDefaults sets the default values for the configuration

type DatabaseConfig

type DatabaseConfig struct {
	DBMS string `env:"DBMS"` // Deprecated
	// DBMS requires more environment variables. Check the database package for more information.
	URL string `env:"DATABASE_URL"`
}

type HttpConfig

type HttpConfig struct {
	Enabled    bool   `env:"HTTP_ENABLED,default=True"`
	Port       int    `env:"HTTP_PORT,default=8080"`
	Address    string `env:"HTTP_ADDRESS,default=:"`
	RootPath   string `env:"HTTP_ROOT_PATH,default=/"`
	AccessLog  bool   `env:"HTTP_ACCESS_LOG,default=True"`
	ServeWebUI bool   `env:"HTTP_SERVE_WEB_UI,default=True"`
	SecretKey  []byte `env:"HTTP_SECRET_KEY"`
	// Fiber Specific
	BodyLimit                    int           `env:"HTTP_BODY_LIMIT,default=1024"`
	ReadTimeout                  time.Duration `env:"HTTP_READ_TIMEOUT,default=10s"`
	WriteTimeout                 time.Duration `env:"HTTP_WRITE_TIMEOUT,default=10s"`
	IDLETimeout                  time.Duration `env:"HTTP_IDLE_TIMEOUT,default=10s"`
	DisableKeepAlive             bool          `env:"HTTP_DISABLE_KEEP_ALIVE,default=true"`
	DisablePreParseMultipartForm bool          `env:"HTTP_DISABLE_PARSE_MULTIPART_FORM,default=true"`
}

func (*HttpConfig) SetDefaults

func (c *HttpConfig) SetDefaults(logger *logrus.Logger)

SetDefaults sets the default values for the configuration

type StorageConfig

type StorageConfig struct {
	DataDir string `env:"DIR"` // Using DIR to be backwards compatible with the old config
}

Jump to

Keyboard shortcuts

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