util

package
v0.0.0-...-7735b63 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminRole     = "admin"
	ModeratorRole = "moderator"
	UserRole      = "user"
)

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

func HashPassword

func HashPassword(password string) (string, error)

HashPassword returns the bycrypt hash of the password

func RandomEmail

func RandomEmail() string

func RandomInt

func RandomInt(min, max int64) int64

RandomInt Random int between min and max

func RandomOwner

func RandomOwner() string

func RandomString

func RandomString(n int) string

RandomString Random string of n chars

Types

type Config

type Config struct {
	Enviroment           string `mapstructure:"ENVIRONMENT"`
	DBDriver             string `mapstructure:"DB_DRIVER"`
	DBSource             string `mapstructure:"DB_SOURCE"`
	HttpServerAddress    string `mapstructure:"HTTP_SERVER_ADDRESS"`
	GrpcServerAddress    string `mapstructure:"GRPC_SERVER_ADDRESS"`
	MigrationUrl         string `mapstructure:"MIGRATION_URL"`
	PasetoPublicKeyStr   string `mapstructure:"PASETO_PUBLIC_KEY"`
	PasetoPrivateKeyStr  string `mapstructure:"PASETO_PRIVATE_KEY"`
	PasetoPublicKey      ed25519.PublicKey
	PasetoPrivateKey     ed25519.PrivateKey
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	RedisAddress         string        `mapstructure:"REDIS_ADDRESS"`
	SESFromEmail         string        `mapstructure:"SES_FROM_EMAIL"`
	SESMailRegion        string        `mapstructure:"SES_MAIL_REGION"`
	AWSAccessKeyID       string        `mapstructure:"AWS_ACCESS_KEY_ID"`
	AWSSecretAccessKey   string        `mapstructure:"AWS_SECRET_ACCESS_KEY"`
	AWSDefaultRegion     string        `mapstructure:"AWS_DEFAULT_REGION"`
}

Config Stores all configuration env variables loaded from app.env using viper The annotations tell viper what the name of each value is in the .env file (uses map structure)

func LoadConfig

func LoadConfig(path string) (config Config, err error)

Jump to

Keyboard shortcuts

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