internal

package
v0.0.0-...-6d8caf4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsynqLogLevel

func AsynqLogLevel(level slog.Level) asynq.LogLevel

AsynqLogLevel converts level into an equivalent asynq.LogLevel.

func TextUnmarshalerDecodeHook

func TextUnmarshalerDecodeHook(from reflect.Value, to reflect.Value) (any, error)

TextUnmarshalerDecodeHook is a decoding hook for the mapstructure package. The decoding hook implements support for the encoding.TextUnmarshaler interface.

Types

type AsynqLogger

type AsynqLogger struct {
	Logger *slog.Logger     // underlying logger
	Sig    chan<- os.Signal // termination signal
}

AsynqLogger is an implementation of asynq.Logger backed by a slog.Logger. This logger implements the Fatal method by sending a termination signal.

func (*AsynqLogger) Debug

func (l *AsynqLogger) Debug(args ...any)

Debug logs a message at Debug level.

func (*AsynqLogger) Error

func (l *AsynqLogger) Error(args ...any)

Error logs a message at Error level.

func (*AsynqLogger) Fatal

func (l *AsynqLogger) Fatal(args ...any)

Fatal logs a message at Error level. Additionally Fatal sends a SIGINT to the current process, leading to the program's termination.

func (*AsynqLogger) Info

func (l *AsynqLogger) Info(args ...any)

Info logs a message at Info level.

func (*AsynqLogger) Warn

func (l *AsynqLogger) Warn(args ...any)

Warn logs a message at Warning level.

type Config

type Config struct {
	Debug bool `mapstructure:"debug"`
	Log   struct {
		Level  slog.Level `mapstructure:"level"`
		Format string     `mapstructure:"format"`
	} `mapstructure:"log"`
	DBConnection    string `mapstructure:"db-url"`
	RedisConnection string `mapstructure:"redis-url"`
	API             struct {
		Address string `mapstructure:"address"`
	} `mapstructure:"api"`
	TaskRunner struct {
		Workers int `mapstructure:"workers"`
	} `mapstructure:"task-server"`
	Uploads struct {
		Dir string `mapstructure:"dir"`
	} `mapstructure:"uploads"`
	Media struct {
		Dir string `mapstructure:"dir"`
	} `mapstructure:"media"`
	Jobs map[string]JobConfig `mapstructure:"jobs"`
}

type JobConfig

type JobConfig struct {
	Enabled  bool           `mapstructure:"enabled"`
	Schedule string         `mapstructure:"schedule"`
	Config   map[string]any `mapstructure:",remain"`
}

Jump to

Keyboard shortcuts

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