-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: support loading Elixir modules for auth #4315
feat: support loading Elixir modules for auth #4315
Conversation
dfbec82
to
b86c081
Compare
This can be tested with this dummy module https://gist.github.com/marc0s/754bf23e3a4a01ab831246342b1e7621 Tell me if you prefer it to be included in the PR to be added to the sources (like |
Is there something I can do about the failing CI checks? Seems that some files are missing and that they're failing for other PRs... |
Great PR, thanks!
All the failed checks are produced by just one single error, reported by the Dialyzer static analysis tool. That small patch should solve it . Please apply to your code and resubmit: diff --git a/src/econf.erl b/src/econf.erl
index f94d0db77..0ffd05e4e 100644
--- a/src/econf.erl
+++ b/src/econf.erl
@@ -511,7 +511,7 @@ db_type(M) ->
ElixirModule = "Elixir." ++ atom_to_list(T),
case code:ensure_loaded(list_to_atom(ElixirModule)) of
{module, _} -> list_to_atom(ElixirModule);
- {error, x} -> fail({bad_db_type, M, T})
+ {error, _} -> fail({bad_db_type, M, T})
end
end
end).
Yes, can you include it with this name |
0075c75
to
f0dc821
Compare
Allow to specify an Elixir module name in `auth_method`. If the referenced module, `M`, cannot be loaded as `ejabberd_auth_M`, try to load it as `Elixir.M`.
f0dc821
to
17b5b34
Compare
Now that Dialyzer succeeds, the test progress and now the Elvis style reviewer complains:
It refers to that line: <<"Elixir" , _/binary>> -> misc:binary_to_atom(hd(T)); Right now it has a space, for example |
Allow to specify an Elixir module name in
auth_method
. This would allow to create custom auth modules using Elixir.If the referenced module,
M
, cannot be loaded asejabberd_auth_M
, try to load it asElixir.M
.This is my first contribution to this repo (and my first in Erlang at all), so please excuse me any basic mistake I could have done. Tell me and I'll fix them :)