Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HMACSecret ¶
func HMACSecret() string
HMACSecret returns the DIGEST_HMAC_SECRET env var. Used by the unsubscribe handler to read the secret at request time rather than caching it at startup.
func Run ¶
Run sends weekly digest emails to eligible tenants whose deterministic send-day matches today's day of week.
When Config.TestUsername is set, only that tenant receives a digest (day-of-week check is skipped).
func UnsubscribeToken ¶
UnsubscribeToken generates an HMAC-SHA256 token for one-click unsubscribe.
func ValidateUnsubscribeToken ¶
ValidateUnsubscribeToken checks an unsubscribe token.
Types ¶
type Config ¶
type Config struct {
ResendAPIKey string
BaseURL string
HMACSecret string
// TestUsername restricts sending to a single tenant (by username).
// When set, only that tenant receives the digest; all others are skipped.
// Derived from DEVPULSE_ADMIN_USERS when DIGEST_ADMIN_ONLY is true.
TestUsername string
}
Config holds configuration for the digest sender.
func NewConfigFromEnv ¶
func NewConfigFromEnv() *Config
NewConfigFromEnv creates a Config from environment variables. Returns nil if any required variable (SEND_API_KEY, BASE_URL, DIGEST_HMAC_SECRET) is missing.