Add default config for Bodyguard.Plug.Authorize plug options
schrockwell opened this issue · 2 comments
schrockwell commented
Example:
config :bodyguard, Bodyguard.Plug.Authorize,
action: {Phoenix.Controller, :current_action},
user: {App, :get_current_user}
Note we probably shouldn't/can't use anonymous functions in config files.
These would be merged in with the plug options, which would take precedence.
jung-hunsoo commented
In Coherence, the function is Coherence.current_user(conn).
And I'm worry about the default action won't useful when the Bodyguard is in the context.
Buy the way defining defaults will be useful in productivity.
Can the fallback be configured too?
schrockwell commented
This is available in 2.4.0 now! See the docs for the correct syntax.
@jung-hunsoo yes, the default value for any option can be configured