Phoenix pipe_through macro syntax

Hi all,

Quick question about the pipe_though macro syntax,

I have a plug that checks if a user has access to a role before authenticating requests.

It works well when used like

pipeline :admin_only do
  plug :browser
  plug :only_role, "admin"
end

But I wish I could use it in a syntax similar to

pipe_through [:browser, only_role: "admin"]

Is there any way to use the pipe_through macro/similar syntax when passing opts to a plug?

Thanks

1 Like