Filter out MIX_ENV from route list and add a test
This commit is contained in:
parent
8ad1613717
commit
6b87dfad5d
2 changed files with 35 additions and 1 deletions
|
|
@ -28,6 +28,8 @@ defmodule Pleroma.Web do
|
|||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||
alias Pleroma.Web.Plugs.PlugHelper
|
||||
|
||||
@mix_env Mix.env()
|
||||
|
||||
def controller do
|
||||
quote do
|
||||
use Phoenix.Controller, namespace: Pleroma.Web
|
||||
|
|
@ -236,7 +238,11 @@ defmodule Pleroma.Web do
|
|||
|
||||
def get_api_routes do
|
||||
Pleroma.Web.Router.__routes__()
|
||||
|> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end)
|
||||
|> Enum.reject(fn
|
||||
r ->
|
||||
r.plug == Pleroma.Web.Fallback.RedirectController or
|
||||
String.starts_with?(r.path, "/#{@mix_env}")
|
||||
end)
|
||||
|> Enum.map(fn r ->
|
||||
r.path
|
||||
|> String.split("/", trim: true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue