iilyak commented on a change in pull request #1432: Support callback module
data provider
URL: https://github.com/apache/couchdb/pull/1432#discussion_r202025181
##########
File path: src/couch_epi/src/couch_epi_data.erl
##########
@@ -102,12 +102,15 @@ definitions({file, FilePath}) ->
{error, Reason} ->
{error, {FilePath, Reason}}
end;
-definitions({module, Module}) when is_atom(Module) ->
- definitions({module, [Module]});
-definitions({module, Modules}) ->
+definitions({static_module, Module}) when is_atom(Module) ->
+ definitions({static_module, [Module]});
+definitions({static_module, Modules}) ->
Data = lists:append([M:data() || M <- Modules]),
Hash = couch_epi_functions_gen:hash(Modules),
- {ok, Hash, Data}.
+ {ok, Hash, Data};
+definitions({callback_module, Module}) ->
+ Data = Module:data(),
Review comment:
In other words what you need is to add `dreyfus_epi` to `coach_epi.config`
(if it is not there), add `{callback_module, dreyfus_config}` into
`dreyfus_epi:data_providers()` and define `dreyfus_config:data/0` function.
You don't need to worry about generating the module or re-generating it on
change.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services