configurations

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFileWasCreated    = apperrors.Business("a new config file was created (%s)", "CONF:001")
	ErrFailEnsureConfig     = apperrors.System(nil, "fail to ensure config", "CONF:002")
	ErrMissingTelegramToken = apperrors.System(nil, "missing telegram token", "CONF:003")
	ErrFailToLoadConfig     = apperrors.System(nil, "fail to load config", "CONF:004")
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Debug    bool                          `fig:"-"        yaml:"-"`
	Timezone string                        `fig:"timezone" yaml:"timezone"`
	Logger   Logger                        `fig:"logger"   yaml:"logger"`
	Telegram telegram.Config               `fig:"telegram" yaml:"telegram"`
	Storage  database.Options              `fig:"storage"  yaml:"storage"`
	Cron     cron.TasksConfig[model.Entry] `fig:"cron"     yaml:"cron"`
}

func Ctx

func Ctx(ctx context.Context) *AppConfig

func Load

func Load(file string) (AppConfig, error)

func (AppConfig) Tags

func (c AppConfig) Tags() map[string]interface{}

func (*AppConfig) WithContext

func (c *AppConfig) WithContext(ctx context.Context) context.Context

type Logger

type Logger struct {
	Level  string `default:"info" fig:"level"  yaml:"level"`
	Format string `default:"text" fig:"format" yaml:"format"`
}

func (Logger) Debug

func (l Logger) Debug(level string) bool

Jump to

Keyboard shortcuts

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