Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment/beacon #592

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
import_deps: [:ecto, :ecto_sql, :phoenix],
import_deps: [:beacon_live_admin, :beacon, :ecto, :ecto_sql, :phoenix],
subdirectories: ["priv/*/migrations"],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"]
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config :radiator, RadiatorWeb.Endpoint,
url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: RadiatorWeb.ErrorHTML, json: RadiatorWeb.ErrorJSON],
formats: [html: Beacon.Web.ErrorHTML, json: RadiatorWeb.ErrorJSON],
layout: false
],
pubsub_server: Radiator.PubSub,
Expand Down
8 changes: 8 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import Config

config :beacon,
radiator: [
site: :radiator,
repo: Radiator.Repo,
endpoint: RadiatorWeb.Endpoint,
router: RadiatorWeb.Router
]

# config/runtime.exs is executed for all environments, including
# during releases. It is executed after compilation and before the
# system starts, so it is typically used to load production configuration
Expand Down
1 change: 1 addition & 0 deletions lib/radiator/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defmodule Radiator.Application do
# Start to serve requests, typically the last entry
RadiatorWeb.Endpoint,
{CommandQueue, name: CommandQueue},
{Beacon, [sites: [Application.fetch_env!(:beacon, :radiator)]]},
{CommandProcessor, name: CommandProcessor, subscribe_to: [{CommandQueue, max_demand: 1}]},
{NodeChangeListener, name: NodeChangeListener},
{Registry, keys: :unique, name: Radiator.JobRegistry},
Expand Down
12 changes: 12 additions & 0 deletions lib/radiator_web/router.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
defmodule RadiatorWeb.Router do
use RadiatorWeb, :router

use Beacon.Router
use Beacon.LiveAdmin.Router
import RadiatorWeb.UserAuth

pipeline :beacon_admin do
plug Beacon.LiveAdmin.Plug
end

pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
Expand All @@ -17,6 +23,12 @@ defmodule RadiatorWeb.Router do
plug :accepts, ["json"]
end

scope "/beacon" do
pipe_through [:browser, :beacon_admin]
beacon_live_admin "/admin"
beacon_site "/cms", site: :radiator
end

scope "/", RadiatorWeb do
pipe_through :browser

Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ defmodule Radiator.MixProject do
# Type `mix help deps` for examples and options.
defp deps do
[
{:beacon_live_admin, "~> 0.2"},
{:beacon, "~> 0.2"},
{:argon2_elixir, "~> 3.0"},
{:bandit, "~> 1.5"},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
Expand Down Expand Up @@ -68,7 +70,8 @@ defmodule Radiator.MixProject do
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:timex, "~> 3.7"},
{:web_inspector, git: "https://github.com/eteubert/web_inspector.git"}
{:web_inspector, git: "https://github.com/eteubert/web_inspector.git"},
{:igniter, "~> 0.4"}
]
end

Expand Down
29 changes: 29 additions & 0 deletions mix.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions priv/repo/migrations/20241119171313_create_beacon_tables.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defmodule Radiator.Repo.Migrations.CreateBeaconTables do
use Ecto.Migration

def up, do: Beacon.Migration.up()
def down, do: Beacon.Migration.down()
end
Loading