infra

package
v0.0.0-...-ff4c41b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoDatabase

func NewMongoDatabase(m *MongoConfig) *mongo.Database

func NewRedisClient

func NewRedisClient(r *RedisConfig) redis.UniversalClient

Types

type EmailClient

type EmailClient interface {
	Send(to []string, subject string, mime string, message string) error
}

func NewEmailClient

func NewEmailClient(config EmailConfig) EmailClient

type EmailConfig

type EmailConfig struct {
	Host     string `env:"EMAIL_HOST" yaml:"host" default:"localhost"`
	Port     int    `env:"EMAIL_PORT" yaml:"port" default:"25"`
	Username string `env:"EMAIL_USERNAME" yaml:"username" default:""`
	Password string `env:"EMAIL_PASSWORD" yaml:"password" default:""`
}

type InfraComponent

type InfraComponent interface {
	Redis() redis.UniversalClient
	Mongo() *mongo.Database
}

func NewInfraComponent

func NewInfraComponent(config InfraConfig) InfraComponent

type InfraConfig

type InfraConfig struct {
	RedisConfig RedisConfig `yaml:"redis"`
	MongoConfig MongoConfig `yaml:"mongo"`
}

type MongoConfig

type MongoConfig struct {
	DbName   string `env:"MONGO_DB" yaml:"db_name" default:"church-management"`
	URI      string `env:"MONGO_URL" yaml:"hosts" default:"127.0.0.1:27017"`
	Username string `env:"MONGO_USERNAME" yaml:"username" default:""`
	Password string `env:"MONGO_PASSWORD" yaml:"password" default:""`
}

type RedisConfig

type RedisConfig struct {
	Hosts          string        `env:"REDIS_URL" yaml:"hosts" default:"127.0.0.1:6379"`
	Username       string        `env:"REDIS_USERNAME" yaml:"username" default:"default"`
	Password       string        `env:"REDIS_PASSWORD" yaml:"password" default:""`
	MaxRetries     int           `env:"REDIS_MAX_RETRIES" yaml:"maxRetries" default:"3"`
	ReadTimeout    time.Duration `env:"REDIS_READ_TIMEOUT" yaml:"readTimeout"`
	WriteTimeout   time.Duration `env:"REDIS_WRITE_TIMEOUT" yaml:"writeTimeout"`
	RouteByLatency bool          `env:"REDIS_ROUTE_BY_LATENCY" yaml:"routeByLatency"`
	UseTLS         bool          `env:"REDIS_USE_TLS" yaml:"useTLS" default:"true"`
}

Jump to

Keyboard shortcuts

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