add swoosh and oban

This commit is contained in:
2022-02-08 19:59:23 -05:00
parent acf64cee18
commit a39c3da351
26 changed files with 365 additions and 84 deletions

View File

@ -43,6 +43,12 @@ config :swoosh, :api_client, false
# Gettext
config :gettext, :default_locale, "en_US"
# Configure Oban
config :cannery, Oban,
repo: Cannery.Repo,
plugins: [Oban.Plugins.Pruner],
queues: [default: 10, mailers: 20]
# Configure esbuild (the version is required)
# config :esbuild,
# version: "0.14.0",

View File

@ -26,7 +26,9 @@ database_url =
"ecto://postgres:postgres@cannery-db/cannery"
end
host = System.get_env("HOST") || "localhost"
host =
System.get_env("HOST") ||
raise "No hostname set! Must be the domain and tld like `cannery.bubbletea.dev`."
interface =
if config_env() in [:dev, :test],
@ -65,6 +67,17 @@ if config_env() == :prod do
config :cannery, CanneryWeb.Endpoint, secret_key_base: secret_key_base
# Set up SMTP settings
config :cannery, Cannery.Mailer,
adapter: Swoosh.Adapters.SMTP,
relay: System.get_env("SMTP_HOST") || raise("No SMTP_HOST set!"),
port: System.get_env("SMTP_PORT") || 587,
username: System.get_env("SMTP_USERNAME") || raise("No SMTP_USERNAME set!"),
password: System.get_env("SMTP_PASSWORD") || raise("No SMTP_PASSWORD set!"),
ssl: System.get_env("SMTP_SSL") == "true",
email_from: System.get_env("EMAIL_FROM") || "no-reply@#{System.get_env("HOST")}",
email_name: System.get_env("EMAIL_NAME") || "Cannery"
# ## Using releases
#
# If you are doing OTP releases, you need to instruct Phoenix

View File

@ -27,3 +27,6 @@ config :logger, level: :warn
# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime
# Disable Oban
config :cannery, Oban, queues: false, plugins: false