]> granicus.if.org Git - ejabberd/commitdiff
Read jwt_key from file
authorAlexey Shchepin <alexey@process-one.net>
Wed, 3 Jul 2019 02:32:58 +0000 (05:32 +0300)
committerAlexey Shchepin <alexey@process-one.net>
Wed, 3 Jul 2019 02:33:35 +0000 (05:33 +0300)
src/ejabberd_options.erl

index 2e061f1c48cbdf7843f63f9e7ae94e165b854f58..b74dea045ef2c956512b39e4e11791186d100751 100644 (file)
@@ -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