Documentation
¶
Index ¶
- Variables
- func GetKramerism() string
- func SendPostRequest(url string, jsonBody []byte)
- func SetupLogger(logLevel zapcore.Level, fileMode bool) *zap.Logger
- func ShortenString(str string, length int) string
- func ValidateConfig(config *Config) error
- type APIConfig
- type AmazonConfig
- type Config
- type EmailService
- func (s *EmailService) Enabled() bool
- func (s *EmailService) Send(to, subject, htmlBody string) error
- func (s *EmailService) SendDailySummary(to string, ozbDeals []models.OzBargainDeal, amzDeals []models.CamCamCamDeal) error
- func (s *EmailService) SendPasswordResetEmail(to, resetLink string) error
- func (s *EmailService) SendVerificationEmail(to, verifyLink string) error
- type OzBargainConfig
- type PipupConfig
- type RssParser
- type SMTPConfig
- type SQLiteConfig
- type ScrapersConfig
Constants ¶
This section is empty.
Variables ¶
var Logger *zap.Logger
Functions ¶
func SendPostRequest ¶
Send a post request to the webhook
func SetupLogger ¶
function to setup the logger
func ShortenString ¶
Function to shorten a string to specified length
func ValidateConfig ¶
ValidateConfig validates the configuration
Types ¶
type APIConfig ¶
type APIConfig struct {
Enabled bool `mapstructure:"enabled"`
Port int `mapstructure:"port"`
WebURL string `mapstructure:"web_url"`
CORSOrigins []string `mapstructure:"cors_origins"`
JWTExpiryHours int `mapstructure:"jwt_expiry_hours"`
SummaryTimezone string `mapstructure:"summary_timezone"`
}
APIConfig holds configuration for the HTTP API server.
type AmazonConfig ¶
type AmazonConfig struct {
ScrapeInterval int `mapstructure:"scrape_interval"`
MaxStoredDeals int `mapstructure:"max_stored_deals"`
URLs []string `mapstructure:"urls"`
TargetPriceDrop int `mapstructure:"target_price_drop"`
}
AmazonConfig holds Amazon scraper configuration
type Config ¶
type Config struct {
LogLevel int `mapstructure:"log_level"`
LogToFile bool `mapstructure:"log_to_file"`
TestMode bool `mapstructure:"test_mode"`
SQLite SQLiteConfig
Scrapers ScrapersConfig
Pipup PipupConfig
API APIConfig
SMTP SMTPConfig
}
Config holds the application configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with default values
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
EmailService sends transactional emails via SMTP (STARTTLS, port 587). If Host or Username is empty, Send is a no-op (graceful degradation for self-hosted deployments without an SMTP server configured).
func NewEmailService ¶
func NewEmailService(cfg SMTPConfig) *EmailService
NewEmailService creates an EmailService from the provided config.
func (*EmailService) Enabled ¶
func (s *EmailService) Enabled() bool
Enabled reports whether SMTP is configured (Host is sufficient; auth is optional).
func (*EmailService) Send ¶
func (s *EmailService) Send(to, subject, htmlBody string) error
Send delivers an HTML email. Returns nil without sending if SMTP is not configured. When Username is empty, authentication is skipped (suitable for unauthenticated local SMTP relays).
func (*EmailService) SendDailySummary ¶
func (s *EmailService) SendDailySummary(to string, ozbDeals []models.OzBargainDeal, amzDeals []models.CamCamCamDeal) error
SendDailySummary sends the nightly deal digest email. ozbDeals should be pre-filtered to OZB_SUPER type, sorted by votes descending. amzDeals should be pre-filtered to AMZ_DAILY type.
func (*EmailService) SendPasswordResetEmail ¶
func (s *EmailService) SendPasswordResetEmail(to, resetLink string) error
SendPasswordResetEmail sends the password reset email.
func (*EmailService) SendVerificationEmail ¶
func (s *EmailService) SendVerificationEmail(to, verifyLink string) error
SendVerificationEmail sends the account verification email.
type OzBargainConfig ¶
type OzBargainConfig struct {
ScrapeInterval int `mapstructure:"scrape_interval"`
MaxStoredDeals int `mapstructure:"max_stored_deals"`
}
OzBargainConfig holds OzBargain scraper configuration
type PipupConfig ¶
type PipupConfig struct {
Enabled bool `mapstructure:"enabled"`
Username string `mapstructure:"username"`
BaseURL string `mapstructure:"base_url"`
Duration int `mapstructure:"duration"`
MediaType string `mapstructure:"media_type"`
MediaURI string `mapstructure:"media_uri"`
ImageWidth int `mapstructure:"image_width"`
Position int `mapstructure:"position"`
TitleColor string `mapstructure:"title_color"`
TitleSize int `mapstructure:"title_size"`
MessageColor string `mapstructure:"message_color"`
MessageSize int `mapstructure:"message_size"`
BackgroundColor string `mapstructure:"background_color"`
}
PipupConfig holds Android TV notification configuration
type SMTPConfig ¶
type SMTPConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
From string `mapstructure:"from"`
}
SMTPConfig holds outbound email (STARTTLS) configuration.
type SQLiteConfig ¶
type SQLiteConfig struct {
DBPath string `mapstructure:"db_path"`
}
SQLiteConfig holds SQLite database configuration
type ScrapersConfig ¶
type ScrapersConfig struct {
OzBargain OzBargainConfig `mapstructure:"ozbargain"`
Amazon AmazonConfig `mapstructure:"amazon"`
}
ScrapersConfig holds configuration for all scrapers