Add Oban for background jobs.
This commit is contained in:
@@ -10,6 +10,11 @@ defmodule DecentralisedBookIndex.Application do
|
||||
children = [
|
||||
DecentralisedBookIndexWeb.Telemetry,
|
||||
DecentralisedBookIndex.Repo,
|
||||
{Oban,
|
||||
AshOban.config(
|
||||
Application.fetch_env!(:decentralised_book_index, :ash_domains),
|
||||
Application.fetch_env!(:decentralised_book_index, Oban)
|
||||
)},
|
||||
{DNSCluster,
|
||||
query: Application.get_env(:decentralised_book_index, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: DecentralisedBookIndex.PubSub},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
defmodule DecentralisedBookIndexWeb.Router do
|
||||
use DecentralisedBookIndexWeb, :router
|
||||
|
||||
import Oban.Web.Router
|
||||
import Oban.Web.Router
|
||||
use AshAuthentication.Phoenix.Router
|
||||
|
||||
import AshAuthentication.Plug.Helpers
|
||||
@@ -35,7 +37,8 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
scope "/", DecentralisedBookIndexWeb do
|
||||
pipe_through :browser
|
||||
|
||||
ash_authentication_live_session :moderator_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :moderator_required} do
|
||||
ash_authentication_live_session :moderator_authenticated_routes,
|
||||
on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :moderator_required} do
|
||||
live "/books/new", BookLive.Edit, :new
|
||||
live "/books/:alternative_book_id/new", BookLive.Edit, :new
|
||||
live "/books/:id/edit", BookLive.Edit, :edit
|
||||
@@ -51,7 +54,8 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
live "/publishers/:id", PublisherLive.Show, :show
|
||||
end
|
||||
|
||||
ash_authentication_live_session :admin_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :admin_required} do
|
||||
ash_authentication_live_session :admin_authenticated_routes,
|
||||
on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :admin_required} do
|
||||
live "/servers", DbiServerLive.Index, :index
|
||||
live "/servers/new", DbiServerLive.Edit, :new
|
||||
live "/servers/:id/edit", DbiServerLive.Edit, :edit
|
||||
@@ -63,7 +67,8 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
live "/users/:id/edit", UserLive.Edit, :edit
|
||||
end
|
||||
|
||||
ash_authentication_live_session :maybe_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} do
|
||||
ash_authentication_live_session :maybe_authenticated_routes,
|
||||
on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} do
|
||||
# in each liveview, add one of the following at the top of the module:
|
||||
#
|
||||
# If an authenticated user must be present:
|
||||
@@ -130,5 +135,11 @@ defmodule DecentralisedBookIndexWeb.Router do
|
||||
live_dashboard "/dashboard", metrics: DecentralisedBookIndexWeb.Telemetry
|
||||
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
||||
end
|
||||
|
||||
scope "/" do
|
||||
pipe_through :browser
|
||||
|
||||
oban_dashboard("/oban")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user