utils

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

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) *domainerr.DomainError

func HashPassword

func HashPassword(password string) (string, *domainerr.DomainError)

func RandomEmail

func RandomEmail() string

func RandomInt

func RandomInt(min, max int64) int64

func RandomString

func RandomString(n int) string

func SetConfigFile

func SetConfigFile(file string)

should be used before first call of GetConfig (only for testing)

func StartLogger

func StartLogger()

Types

type Config

type Config struct {
	Environment          string        `validate:"required" koanf:"ENVIRONMENT"`
	HTTPServerAddress    string        `validate:"required" koanf:"HTTP_SERVER_ADDRESS"`
	DBName               string        `validate:"required" koanf:"POSTGRES_DB"`
	DBUser               string        `validate:"required" koanf:"POSTGRES_USER"`
	DBPassword           string        `validate:"required" koanf:"POSTGRES_PASSWORD"`
	DBSource             string        `validate:"required" koanf:"DB_SOURCE"`
	MigrationURL         string        `validate:"required" koanf:"MIGRATION_URL"`
	TokenSymmetricKey    string        `validate:"required" koanf:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `validate:"required" koanf:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `validate:"required" koanf:"REFRESH_TOKEN_DURATION"`
}

func GetConfig

func GetConfig() *Config

GetConfig returns the configuration instance using once.Do to ensure that the configuration is loaded only once

type HashError

type HashError struct {
	// contains filtered or unexported fields
}

func (*HashError) Error

func (e *HashError) Error() string

Jump to

Keyboard shortcuts

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