From ff6884f31328137fc7eb7191650a70e85f04f859 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Wed, 3 Jul 2019 05:32:58 +0300 Subject: [PATCH] Read jwt_key from file --- src/ejabberd_options.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl index 2e061f1c4..b74dea045 100644 --- a/src/ejabberd_options.erl +++ b/src/ejabberd_options.erl @@ -409,7 +409,15 @@ opt_type(websocket_ping_interval) -> opt_type(websocket_timeout) -> econf:timeout(second); opt_type(jwt_key) -> - econf:binary(). + econf:and_then( + econf:file(), + fun(Path) -> + case file:read_file(Path) of + {ok, Binary} -> Binary; + {error, Reason} -> + econf:fail({jtw_key_error, Reason}) + end + end). %% We only define the types of options that cannot be derived %% automatically by tools/opt_type.sh script