Skip to content

Commit

Permalink
Remove deprecated custom defaults from config_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Apr 7, 2022
1 parent 0e64090 commit 840ee05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/inbox/mod_inbox.erl
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,9 @@ hooks(HostType) ->
get_groupchat_types(HostType) ->
gen_mod:get_module_opt(HostType, ?MODULE, groupchat).

-spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}].
config_metrics(HostType) ->
OptsToReport = [{backend, rdbms}], %list of tuples {option, defualt_value}
mongoose_module_metrics:opts_for_module(HostType, ?MODULE, OptsToReport).
mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]).

-spec muclight_enabled(HostType :: mongooseim:host_type()) -> boolean().
muclight_enabled(HostType) ->
Expand Down
6 changes: 2 additions & 4 deletions src/system_metrics/mongoose_module_metrics.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

-optional_callbacks([config_metrics/1]).

-spec opts_for_module(mongooseim:host_type(), module(), list()) -> list().
-spec opts_for_module(mongooseim:host_type(), module(), [gen_mod:opt_key()]) ->
[{gen_mod:opt_key(), gen_mod:opt_value()}].
opts_for_module(HostType, Module, OptsToReport) ->
try
Opts = gen_mod:get_module_opts(HostType, Module),
Expand All @@ -17,8 +18,5 @@ opts_for_module(HostType, Module, OptsToReport) ->
_:_ -> [{none, none}]
end.

get_opt({Opt, DefaultValue}, Opts) ->
% Deprecated, defaults should be specified in the config spec
{Opt, gen_mod:get_opt(Opt, Opts, DefaultValue)};
get_opt(Opt, Opts) ->
{Opt, gen_mod:get_opt(Opt, Opts)}.

0 comments on commit 840ee05

Please sign in to comment.