eraser

Home · Docs · 1.5

Multi-Profile Support

Lets one install send/track removal requests for more than one identity (e.g. a spouse or family member) sharing the same config file, broker database, and inbox, while keeping every profile’s history, pipeline status, and background send jobs fully isolated from the others.

Most installs only ever need one profile - the one set up by eraser init. Everything below only matters once a second profile has been added via eraser profile add.

Backward compatibility

This was designed so a single-profile install needs zero changes:

Config model (internal/config/config.go)

profiles:
  - id: default        # the primary profile, created by `eraser init` / web setup
    first_name: ...
  - id: spouse
    first_name: ...

History scoping (internal/history/history.go)

Nearly every Store method takes a profileID string and filters by it. Two are deliberately global (no profile filter): ClearBrokerResponses and GetAllBrokerResponses. These operate on the one shared IMAP inbox that serves every profile together - a full-inbox rescan/reclassify isn’t a per-profile view.

Shared inbox

A shared mailbox carries replies for every profile’s sent requests together. When processing an inbound reply, attribute it to whichever profile actually emailed that broker - not to whatever profile happens to be “active” in the CLI/web session doing the scan. That’s what Store.ResolveProfileForBroker(brokerID string) (string, error) is for: it looks up the most recent removal_requests row for that broker across all profiles and returns its profile_id (falling back to "default" if the broker was never emailed by anyone). inbox.RecordReply (used by Monitor.ScanAndStore for the CLI monitor, the web scan/rescan and automated cycles) calls this per email before storing the classified response.

Per-profile email accounts (internal/config/config.go)

By default every profile shares the top-level email: (SMTP, for sending) and inbox: (IMAP, for monitoring replies) blocks. A profile can instead set its own mail: block to send and get its replies monitored through a dedicated account - e.g. so each household member’s requests don’t all pile onto one address, lowering per-broker send limits and making it harder to tell whose reply is whose (#75):

profiles:
  - id: spouse
    first_name: ...
    mail:
      email:              # overrides the shared email: block for this profile's sends
        from: [email protected]
        smtp:
          host: smtp.fastmail.com
          port: 465
          username: [email protected]
          password: app-password
      inbox:               # overrides the shared inbox: block for this profile's replies
        enabled: true
        provider: fastmail # preset id fills server/port; or set server + port
        email: [email protected]
        password: app-password

Either field can be set independently - a profile can override just email (send from its own account, still share the default inbox for replies) or just inbox. Send-only providers (Amazon SES) get only email, so their replies fall back to the shared inbox.

CLI (cmd/eraser/)

Web UI (internal/web/, templates/layout.html)

Adding a new per-profile data path

If you add a new history.Store method or web/CLI code path that reads or writes user-specific data, give it a profileID parameter and filter by it - follow the pattern of the existing methods rather than introducing a new scoping mechanism. If the data instead comes from the shared inbox (like broker replies), resolve the owning profile via ResolveProfileForBroker rather than using “whatever profile is active right now”.