config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v1.1.0

func Validate(cfg SMTPConfig) error

Validate checks that all required SMTP fields are present. Call this immediately after LoadConfig to catch misconfigured deployments before any recipients are loaded or any SMTP connections are attempted.

Types

type AppConfig

type AppConfig struct {
	SMTP      SMTPConfig `json:"smtp"`
	TimeoutMs int        `json:"timeout_ms"` // smtp timeout in milliseconds
}

func LoadConfig

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

LoadConfig reads JSON config from disk and returns a parsed AppConfig. It never terminates the process; callers should handle returned errors.

type SMTPConfig

type SMTPConfig struct {
	Host        string `json:"host"`
	Port        int    `json:"port"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	From        string `json:"from"`
	TLSCertFile string `json:"tls_cert_file,omitempty"` // Path to custom CA certificate
	TLSKeyFile  string `json:"tls_key_file,omitempty"`  // Path to client certificate
	InsecureTLS bool   `json:"insecure_tls,omitempty"`  // Skip TLS verification (use with caution)

	// DialTimeout overrides the default 10-second TCP connect timeout.
	// Zero means use the default.
	DialTimeout time.Duration `json:"-"` // set from CLI flag, not the JSON file
}

Jump to

Keyboard shortcuts

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