config

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultProfileID = "default"

DefaultProfileID is the synthetic ID used for the legacy single Profile block when no profiles: list is configured, and is what pre-multi-profile history rows are attributed to after the profile_id migration.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

func Save

func Save(path string, cfg *Config) error

func SlugifyID

func SlugifyID(s string) string

SlugifyID lowercases and hyphenates s, keeping only [a-z0-9]. Every profile ID must go through it: net/http silently drops non-ASCII bytes from Set-Cookie, so an ID with diacritics breaks the web UI's profile cookie.

func SlugifyProfileID

func SlugifyProfileID(firstName, lastName string, existing []NamedProfile) string

SlugifyProfileID derives an ID from first/last name (see SlugifyID), appending -2, -3, ... when taken.

Types

type Config

type Config struct {
	// Profile is the legacy single-profile block, wrapped by GetProfiles as
	// "default". Ignored once Profiles is non-empty.
	Profile Profile `yaml:"profile"`
	// Profiles tracks removal requests for several people against the same
	// brokers, mail account and options; history is kept per profile
	// (profile_id). Takes precedence over Profile.
	Profiles []NamedProfile `yaml:"profiles,omitempty"`
	Email    EmailConfig    `yaml:"email"`
	Options  Options        `yaml:"options"`
	Inbox    InboxConfig    `yaml:"inbox,omitempty"`
	Pipeline Pipeline       `yaml:"pipeline,omitempty"`
	Schedule Schedule       `yaml:"schedule,omitempty"`
}

func Load

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

func (*Config) ConfiguredInboxes added in v0.8.0

func (c *Config) ConfiguredInboxes() []InboxConfig

ConfiguredInboxes returns every enabled IMAP inbox across profiles (overrides or the shared one), deduplicated by address, so `monitor` covers everyone.

func (*Config) EmailForProfile added in v0.8.0

func (c *Config) EmailForProfile(p NamedProfile) EmailConfig

EmailForProfile returns the SMTP config to use for sends made under this profile: its Mail.Email override if set, otherwise the shared top-level Email block.

func (*Config) GetProfile

func (c *Config) GetProfile(id string) (NamedProfile, error)

GetProfile resolves a profile by ID. Empty id works only when exactly one profile exists; otherwise it errors with the available IDs.

func (*Config) GetProfiles

func (c *Config) GetProfiles() []NamedProfile

GetProfiles returns every profile; with no profiles: list, the legacy profile: block as a single "default" profile.

func (*Config) InboxForProfile added in v0.8.0

func (c *Config) InboxForProfile(p NamedProfile) InboxConfig

InboxForProfile returns the IMAP config to use when monitoring replies for this profile: its Mail.Inbox override if set, otherwise the shared top-level Inbox block.

func (*Config) IsManualSend

func (c *Config) IsManualSend() bool

IsManualSend reports whether the user opted out of automated sending - Eraser renders the emails but never transmits them.

func (*Config) Validate

func (c *Config) Validate() error

func (*Config) ValidateInbox

func (c *Config) ValidateInbox() error

ValidateInbox validates inbox configuration (only called when inbox monitoring is used)

type Email

type Email = EmailConfig

type EmailConfig

type EmailConfig struct {
	Provider string     `yaml:"provider"`
	From     string     `yaml:"from"`
	SMTP     SMTPConfig `yaml:"smtp,omitempty"`
}

type InboxConfig

type InboxConfig struct {
	Enabled       bool   `yaml:"enabled"`
	Provider      string `yaml:"provider"`       // "gmail", "outlook", "imap"
	Server        string `yaml:"server"`         // e.g., "imap.gmail.com"
	Port          int    `yaml:"port"`           // e.g., 993
	Email         string `yaml:"email"`          // Email address to monitor
	Password      string `yaml:"password"`       // App password (not main password)
	Folder        string `yaml:"folder"`         // Folder to monitor (default: "INBOX")
	AutoArchive   bool   `yaml:"auto_archive"`   // Automatically move processed emails to archive folder
	ArchiveFolder string `yaml:"archive_folder"` // Folder to archive emails to (default: "Eraser")
}

InboxConfig holds IMAP settings for monitoring broker responses

type MailConfig added in v0.8.0

type MailConfig struct {
	Email *EmailConfig `yaml:"email,omitempty"`
	Inbox *InboxConfig `yaml:"inbox,omitempty"`
}

MailConfig holds one profile's email/inbox overrides. Either field may be set independently - e.g. a profile can send from its own SMTP account while still sharing the default inbox for reply monitoring.

type NamedProfile

type NamedProfile struct {
	// ID: short, lowercase, hyphenated. Stored verbatim in history.db, so
	// renaming it orphans the profile's existing history.
	ID      string `yaml:"id"`
	Profile `yaml:",inline"`
	// Mail overrides the shared email:/inbox: blocks for this profile only
	// (see EmailForProfile/InboxForProfile). nil = use the shared blocks.
	Mail *MailConfig `yaml:"mail,omitempty"`
}

NamedProfile is a person's identity plus the stable ID used by --profile, history rows and the web UI's switcher.

type Options

type Options struct {
	Template string `yaml:"template"`
	// SendMode:
	//   "" / "smtp" - Eraser sends over the configured SMTP account.
	//   "manual"    - Eraser renders the emails for you to send yourself and
	//                 record with `eraser mark-sent` / "Mark sent". No email:
	//                 block needed; for users who won't share mailbox credentials.
	SendMode    string `yaml:"send_mode,omitempty"`
	DryRun      bool   `yaml:"dry_run"`
	RateLimitMs int    `yaml:"rate_limit_ms"`
	// DailySendLimit caps sends per rolling 24h to stay under provider limits
	// (Gmail ~500/day). 0 = 450. Bypass with --ignore-daily-limit.
	DailySendLimit int `yaml:"daily_send_limit,omitempty"`
	// BrokerList: "" / "full" (~750 entries, default) or "verified"
	// (data/brokers-verified.yaml). Overridden by `send --list`; ignored when
	// BrokerFile or --brokers is set.
	BrokerList string `yaml:"broker_list,omitempty"`
	// BrokerFile points the send-family commands at your own broker list,
	// the config equivalent of the global --brokers flag (which still wins).
	// Takes precedence over BrokerList.
	BrokerFile      string   `yaml:"broker_file,omitempty"`
	Regions         []string `yaml:"regions"`
	ExcludedBrokers []string `yaml:"excluded_brokers,omitempty"`
	// ExcludedCategories skips brokers by category (case-insensitive), e.g.
	// "requires-id" for brokers that demand an ID document.
	ExcludedCategories []string `yaml:"excluded_categories,omitempty"`
}

type Pipeline

type Pipeline struct {
	AutoConfirm   bool `yaml:"auto_confirm"`    // Auto-click confirmation links
	AutoFillForms bool `yaml:"auto_fill_forms"` // Enable browser automation for forms
	// BrowserHeadless is a pointer so an explicit false survives loading (a
	// plain bool was forced back to true). Read it via Headless().
	BrowserHeadless   *bool `yaml:"browser_headless,omitempty"`
	BrowserTimeoutSec int   `yaml:"browser_timeout_sec"` // Browser operation timeout
}

Pipeline holds settings for the automation pipeline

func (Pipeline) Headless

func (p Pipeline) Headless() bool

Headless returns the effective headless setting, defaulting to true when BrowserHeadless was never set in the config.

type Profile

type Profile struct {
	FirstName string `yaml:"first_name"`
	// MiddleName: some brokers (background-check, financial-b2b) match on
	// full legal name.
	MiddleName string `yaml:"middle_name,omitempty"`
	LastName   string `yaml:"last_name"`
	Email      string `yaml:"email"`
	// AdditionalEmails: older addresses a broker may have indexed you under.
	AdditionalEmails []string `yaml:"additional_emails,omitempty"`
	// NameVariants covers other spellings brokers may have indexed you under -
	// e.g. a diacritic-free version of your name ("Maris" for "Māris"), a
	// maiden name, or a nickname you've used to sign up for things.
	NameVariants []string `yaml:"name_variants,omitempty"`
	// PreviousAddresses: partial ones still help, since matching keys off
	// street/city/postal code.
	PreviousAddresses []string `yaml:"previous_addresses,omitempty"`
	Address           string   `yaml:"address,omitempty"`
	City              string   `yaml:"city,omitempty"`
	State             string   `yaml:"state,omitempty"`
	ZipCode           string   `yaml:"zip_code,omitempty"`
	Country           string   `yaml:"country,omitempty"`
	Phone             string   `yaml:"phone,omitempty"`
	// AdditionalPhones covers other numbers you've used to sign up for
	// things (an old number, a work line) that a broker might have on file
	// instead of your current one.
	AdditionalPhones []string `yaml:"additional_phones,omitempty"`
	DateOfBirth      string   `yaml:"date_of_birth,omitempty"`
}

func (Profile) FullName

func (p Profile) FullName() string

type SMTPConfig

type SMTPConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	UseTLS   bool   `yaml:"use_tls"`
}

type Schedule added in v0.9.0

type Schedule struct {
	// Enabled makes a running 'eraser serve' run a cycle every 6 hours.
	// Ignored while the OS job is installed.
	Enabled bool `yaml:"enabled,omitempty"`
}

Schedule is the in-app fallback for automated cycles when the OS scheduler ('eraser schedule install') isn't set up.

Jump to

Keyboard shortcuts

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