Skip to content

Commit cdcf3ef

Browse files
committed
mod_invites: Check at start time the syntax of landing_page option (#4525)
1 parent afd49b9 commit cdcf3ef

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/mod_invites.erl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,24 @@ mod_opt_type(db_type) ->
292292
econf:db_type(?MODULE);
293293
mod_opt_type(landing_page) ->
294294
econf:either(
295-
econf:enum([none, auto]), econf:binary());
295+
econf:enum([none, auto]),
296+
econf:and_then(
297+
econf:binary(),
298+
fun(Tmpl) ->
299+
try
300+
mod_invites_http:tmpl_to_renderer(Tmpl) of
301+
R when is_atom(R) ->
302+
Tmpl
303+
catch
304+
error:{badmatch, error} ->
305+
T = <<"There is some problem in the value you configured "
306+
"for option 'landing_page' in 'mod_invites'. "
307+
"Please consult the documentation and fix it: ",
308+
Tmpl/binary>>,
309+
?CRITICAL_MSG(T, []),
310+
throw({error, T})
311+
end
312+
end));
296313
mod_opt_type(max_invites) ->
297314
econf:pos_int(infinity);
298315
mod_opt_type(site_name) ->

src/mod_invites_http.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
-include("logger.hrl").
3030

31-
-export([process/2, landing_page/2]).
31+
-export([process/2, landing_page/2, tmpl_to_renderer/1]).
3232

3333
-ifdef(TEST).
3434
-export([apps_json/3]).

0 commit comments

Comments
 (0)