config

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() (Config, []FutureLog)

Get loads the application config.

Types

type Config

type Config struct {
	Port               int      `default:"3030"`
	LogLevel           LogLevel `default:"info" split_words:"true"`
	DefaultUserName    string   `default:"admin" split_words:"true"`
	DefaultUserPass    string   `default:"admin" split_words:"true"`
	PassStrength       int      `default:"10" split_words:"true"`
	DatabaseDialect    string   `default:"sqlite3" split_words:"true"`
	DatabaseConnection string   `default:"data/traggo.db" split_words:"true"`
}

Config represents the application configuration.

type FutureLog

type FutureLog struct {
	Level zerolog.Level
	Msg   string
}

FutureLog is an intermediate type for log messages. It is used before the config was loaded because without loaded config we do not know the log level, so we log these messages once the config was initialized.

type LogLevel

type LogLevel zerolog.Level

LogLevel type that provides helper methods for decoding.

func (LogLevel) AsZeroLogLevel

func (ll LogLevel) AsZeroLogLevel() zerolog.Level

AsZeroLogLevel converts the LogLevel to a zerolog.Level.

func (*LogLevel) Decode

func (ll *LogLevel) Decode(value string) error

Decode decodes a string to a log level.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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