Sovite.Core.Repo.Tables.Domains (sovite v0.2.0)

Copy Markdown View Source

Domains stored in Sovite's database, managed with sovitectl domain. They add to the domains in the [domains] config section; a domain in the config file wins over the same domain in the database.

The SMTP server and the queue manager read them from a cache (Sovite.Core.Repo.Tables.DomainCache), refreshed every few seconds, so a change applies without a restart and a database outage does not make hosted domains look foreign.

Summary

Functions

Adds a domain of class kind.

The enabled domains and their classes.

Deletes a domain.

The domain classes: :local, :aliased, :hosted, :relay.

Lists all domains, by name.

Enables or disables a domain. Disabled domains are ignored.

Functions

add(repo, name, kind)

Adds a domain of class kind.

classes(repo)

@spec classes(Sovite.Core.Repo.t()) :: %{
  required(String.t()) => Sovite.Core.Repo.Schemas.Domain.kind()
}

The enabled domains and their classes.

delete(repo, name)

@spec delete(Sovite.Core.Repo.t(), String.t()) :: :ok | {:error, :not_found}

Deletes a domain.

kinds()

The domain classes: :local, :aliased, :hosted, :relay.

list(repo)

Lists all domains, by name.

set_enabled(repo, name, enabled)

@spec set_enabled(Sovite.Core.Repo.t(), String.t(), boolean()) ::
  {:ok, Sovite.Core.Repo.Schemas.Domain.t()}
  | {:error, :not_found | Ecto.Changeset.t()}

Enables or disables a domain. Disabled domains are ignored.