Skip to content

Commit

Permalink
Move the /health route back to the *Web namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
gcauchon committed Feb 10, 2023
1 parent 4aa7dbd commit d45abb1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 33 deletions.
30 changes: 0 additions & 30 deletions lib/elixir_boilerplate_health/router.ex

This file was deleted.

2 changes: 1 addition & 1 deletion lib/elixir_boilerplate_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ defmodule ElixirBoilerplateWeb.Endpoint do
end

defp session(conn, _opts) do
opts = Plug.Session.init(FoundationWeb.Session.get_options())
opts = Plug.Session.init(ElixirBoilerplateWeb.Session.get_options())

Plug.Session.call(conn, opts)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule ElixirBoilerplateHealth do
defmodule ElixirBoilerplateWeb.Healthcheck do
@health_check_error_code 422

def checks do
Expand Down
14 changes: 13 additions & 1 deletion lib/elixir_boilerplate_web/router.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule ElixirBoilerplateWeb.Router do
use Phoenix.Router
use ElixirBoilerplateWeb, :router

pipeline :browser do
plug(:accepts, ~w[html json])
Expand Down Expand Up @@ -36,4 +36,16 @@ defmodule ElixirBoilerplateWeb.Router do
)
end
end

forward(
"/health",
PlugCheckup,
PlugCheckup.Options.new(
json_encoder: Phoenix.json_library(),
checks: ElixirBoilerplateWeb.Healthcheck.checks(),
error_code: ElixirBoilerplateWeb.Healthcheck.error_code(),
timeout: :timer.seconds(5),
pretty: false
)
)
end

0 comments on commit d45abb1

Please sign in to comment.