app

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(cfg *Config) error

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 MustWire

func MustWire(cfg *Config) *Application

MustWire creates application or panics.

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 ChatConfigMap map[string]string

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

func LoadConfig(path string) (*Config, error)

LoadConfig loads configuration from a YAML file.

func MustLoadConfig

func MustLoadConfig(path string) *Config

MustLoadConfig loads config and panics on error.

func (*Config) DefaultChatProvider

func (c *Config) DefaultChatProvider() string

func (*Config) DefaultEmailProvider

func (c *Config) DefaultEmailProvider() string

Default Providers Helpers

func (*Config) DefaultPushProvider

func (c *Config) DefaultPushProvider() string

func (*Config) DefaultSMSProvider

func (c *Config) DefaultSMSProvider() string

type DevBoxConfig

type DevBoxConfig struct {
	Enabled bool `yaml:"enabled"`
	Port    int  `yaml:"port"`
}

DevBoxConfig holds devbox configuration.

type EmailConfig

type EmailConfig struct {
	CommonConfig
	Domain    string
	FromEmail string
	FromName  string
}

EmailConfig holds email provider configuration.

type EmailConfigMap

type EmailConfigMap map[string]string

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 PushConfigMap map[string]string

type SMSConfig

type SMSConfig struct {
	CommonConfig
	FromPhone string
}

SMSConfig holds SMS provider configuration.

type SMSConfigMap

type SMSConfigMap map[string]string

type ServerConfig

type ServerConfig struct {
	Port int `yaml:"port"`
}

ServerConfig holds server configuration.

Directories

Path Synopsis
Package registry provides provider registration functionality.
Package registry provides provider registration functionality.

Jump to

Keyboard shortcuts

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