utils

package
v0.0.0-...-964291d Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLoggerInContext = errors.New("no logger in context")
View Source
var SESSION_TTL = 5 * 24 * time.Hour

Functions

func ErrorJSON

func ErrorJSON(errorMessage string) string

func InjectLoggerIntoContext

func InjectLoggerIntoContext(r *http.Request, entry *slog.Logger) *http.Request

func LogError

func LogError(logger *slog.Logger, err error)

func MustBuildLogger

func MustBuildLogger(config Config) *slog.Logger

func MustGetLogger

func MustGetLogger(r *http.Request) *slog.Logger

func NewSilentLogger

func NewSilentLogger() *slog.Logger

func RequestBuilder

func RequestBuilder(method string, path string) func(request string) *http.Request

Types

type Config

type Config struct {
	DBHost              string
	DBName              string
	DBPass              string
	DBPort              uint
	DBUser              string
	Domain              string
	Port                string
	GoEnv               string
	RequireVerification bool
	Mailjet             Mailjet
	VerificationLink    string
	ForgetPasswordLink  string
	Sender              string
	RedisPort           uint
	RedisHost           string
	RedisPassword       string
	RedisDatabase       int
	SessionCookie       string
}

func BuildConfigFromEnv

func BuildConfigFromEnv() (Config, error)

func (Config) GetConnectionString

func (config Config) GetConnectionString() string

func (Config) HasEmailSetup

func (config Config) HasEmailSetup() bool

func (Config) IsDev

func (config Config) IsDev() bool

type Mailjet

type Mailjet struct {
	ApiKey    string
	SecretKey string
}

Jump to

Keyboard shortcuts

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