bootstrap

package
v0.0.0-...-de52b65 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvFile = ".env" // Environment file name
)

Constants related to configuration

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App struct represents the main application

func InitializeApp

func InitializeApp() (*App, error)

InitializeApp initializes the application using the Wire framework

func NewApp

func NewApp(cfg *Config, db *gorm.DB, e *echo.Echo, sqsConsumer *SQSConsumer, eventController *api.EventController) *App

NewApp creates and returns a new App instance

func (*App) SetupAndRun

func (a *App) SetupAndRun() error

SetupAndRun sets up and runs the application

type Config

type Config struct {
	// Server configuration
	ServerPort int `mapstructure:"SERVER_PORT" validate:"required"`

	// Database configuration
	DBDSN        string `mapstructure:"DB_DSN" validate:"required"`
	DBReplicaDSN string `mapstructure:"DB_REPLICA_DSN"`

	// SQS configuration
	SQSQueueURL            string `mapstructure:"SQS_QUEUE_URL" validate:"required,url"`
	SQSRegion              string `mapstructure:"SQS_REGION" validate:"required"`
	SQSMaxNumberOfMessages int32  `mapstructure:"SQS_MAX_NUMBER_OF_MESSAGES" validate:"required,min=1,max=10"`
	SQSWaitTimeSeconds     int32  `mapstructure:"SQS_WAIT_TIME_SECONDS" validate:"required,min=0,max=20"`
	SQSVisibilityTimeout   int32  `mapstructure:"SQS_VISIBILITY_TIMEOUT" validate:"required,min=0"`

	// External service configuration
	SlackWebhook string `mapstructure:"SLACK_WEBHOOK"`
}

Config struct defines the configuration items for the application

func NewConfig

func NewConfig() (*Config, error)

NewConfig loads the configuration from env file and environment variables

type SQSConsumer

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

SQSConsumer represents a consumer that consumes and processes messages from an AWS SQS queue

func NewSQSConsumer

func NewSQSConsumer(cfg aws.Config, config *Config, eventUsecase domain.EventUsecase) *SQSConsumer

NewSQSConsumer creates a new SQSConsumer instance

func (*SQSConsumer) Start

func (c *SQSConsumer) Start()

Start begins the message consumption loop

Jump to

Keyboard shortcuts

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