Documentation
¶
Overview ¶
Package app imports all providers to trigger their init() registration. Add new provider imports here — this is the ONLY file to modify when adding providers.
Index ¶
- func ValidateConfig(cfg *Config) error
- type Application
- type ChatConfig
- type ChatConfigMap
- type CommonConfig
- type Config
- type DevBoxConfig
- type EmailConfig
- type EmailConfigMap
- type MailpitConfig
- type ProviderConfig
- type ProviderDefaults
- type ProviderFactory
- func (f *ProviderFactory) CreateChatProvider(name string) (port.ChatSender, error)
- func (f *ProviderFactory) CreateEmailProvider(name string) (port.EmailSender, error)
- func (f *ProviderFactory) CreatePushProvider(name string) (port.PushSender, error)
- func (f *ProviderFactory) CreateSMSProvider(name string) (port.SMSSender, error)
- type ProviderType
- type PushConfig
- type PushConfigMap
- type SMSConfig
- type SMSConfigMap
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateConfig ¶
ValidateConfig validates required configuration.
Types ¶
type Application ¶
type Application struct {
Config *Config
GatewayService *service.GatewayService
MemoryStore *memory.Store
Router *presentation.Router
}
Application holds all wired dependencies.
func Wire ¶
func Wire(cfg *Config) (*Application, error)
Wire creates and wires all application dependencies.
type ChatConfig ¶
type ChatConfig struct {
CommonConfig
FromPhone string
WebhookURL string
}
ChatConfig holds chat provider configuration.
type ChatConfigMap ¶
type CommonConfig ¶
type CommonConfig struct {
APIKey string
APISecret string
Region string
BaseURL string
Extra map[string]string
}
CommonConfig shared fields across all providers. The Extra map captures any additional fields not explicitly defined.
type Config ¶
type Config struct {
Environment string `yaml:"environment"`
Server ServerConfig `yaml:"server"`
DevBox DevBoxConfig `yaml:"devbox"`
Providers ProviderConfig `yaml:"providers"`
Mailpit MailpitConfig `yaml:"mailpit,omitempty"`
// Parsed provider configs
EmailProviders map[string]EmailConfig `yaml:"-"`
SMSProviders map[string]SMSConfig `yaml:"-"`
PushProviders map[string]PushConfig `yaml:"-"`
ChatProviders map[string]ChatConfig `yaml:"-"`
}
Config represents the application configuration.
func LoadConfig ¶
LoadConfig loads configuration from a YAML file.
func MustLoadConfig ¶
MustLoadConfig loads config and panics on error.
func (*Config) DefaultChatProvider ¶
func (*Config) DefaultEmailProvider ¶
Default Providers Helpers
func (*Config) DefaultPushProvider ¶
func (*Config) DefaultSMSProvider ¶
type DevBoxConfig ¶
DevBoxConfig holds devbox configuration.
type EmailConfig ¶
type EmailConfig struct {
CommonConfig
Domain string
FromEmail string
FromName string
}
EmailConfig holds email provider configuration.
type EmailConfigMap ¶
Intermediate maps for YAML parsing (allows any key-value pairs)
type MailpitConfig ¶
type MailpitConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
}
MailpitConfig holds SMTP forwarding configuration.
type ProviderConfig ¶
type ProviderConfig struct {
Defaults ProviderDefaults `yaml:"defaults"`
Email map[string]EmailConfigMap `yaml:"email"`
SMS map[string]SMSConfigMap `yaml:"sms"`
Push map[string]PushConfigMap `yaml:"push"`
Chat map[string]ChatConfigMap `yaml:"chat"`
}
ProviderConfig holds provider configuration.
type ProviderDefaults ¶
type ProviderDefaults struct {
Email string `yaml:"email"`
SMS string `yaml:"sms"`
Push string `yaml:"push"`
Chat string `yaml:"chat"`
}
ProviderDefaults holds default provider names.
type ProviderFactory ¶
type ProviderFactory struct {
// contains filtered or unexported fields
}
ProviderFactory creates provider instances using the registry.
func NewProviderFactory ¶
func NewProviderFactory(cfg *Config, store port.MessageStore) *ProviderFactory
NewProviderFactory creates a new provider factory.
func (*ProviderFactory) CreateChatProvider ¶
func (f *ProviderFactory) CreateChatProvider(name string) (port.ChatSender, error)
CreateChatProvider creates a chat provider by name.
func (*ProviderFactory) CreateEmailProvider ¶
func (f *ProviderFactory) CreateEmailProvider(name string) (port.EmailSender, error)
CreateEmailProvider creates an email provider by name.
func (*ProviderFactory) CreatePushProvider ¶
func (f *ProviderFactory) CreatePushProvider(name string) (port.PushSender, error)
CreatePushProvider creates a push provider by name.
func (*ProviderFactory) CreateSMSProvider ¶
func (f *ProviderFactory) CreateSMSProvider(name string) (port.SMSSender, error)
CreateSMSProvider creates an SMS provider by name.
type ProviderType ¶
type ProviderType string
ProviderType defines the type of message provider.
const ( ProviderTypeEmail ProviderType = "email" ProviderTypeSMS ProviderType = "sms" ProviderTypePush ProviderType = "push" ProviderTypeChat ProviderType = "chat" )
type PushConfig ¶
type PushConfig struct {
CommonConfig
AppID string
Topic string
}
PushConfig holds push notification provider configuration.
type PushConfigMap ¶
type SMSConfig ¶
type SMSConfig struct {
CommonConfig
FromPhone string
}
SMSConfig holds SMS provider configuration.
type SMSConfigMap ¶
type ServerConfig ¶
type ServerConfig struct {
Port int `yaml:"port"`
}
ServerConfig holds server configuration.