OPS-161: Provide simpler get_handler/1 in modernizer backend (#12)

This commit is contained in:
Andrew Mayorov 2022-08-26 14:05:03 +03:00 committed by GitHub
parent dc899e245b
commit 19cdc6c846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,7 @@
-export([new/2]).
-export([get_routes/2]).
-export([get_handler/2]).
-export([get_handler/1]).
%% Machinery backend
-behaviour(machinery_modernizer_backend).
@ -82,7 +83,11 @@ get_routes(Handlers, Opts) ->
machinery_utils:get_woody_routes(Handlers, fun get_handler/2, Opts).
-spec get_handler(handler(), machinery_utils:route_opts()) -> machinery_utils:woody_handler().
get_handler(#{path := Path, backend_config := Config}, _) ->
get_handler(Handler, _) ->
get_handler(Handler).
-spec get_handler(handler()) -> machinery_utils:woody_handler().
get_handler(#{path := Path, backend_config := Config}) ->
{Path, {
{mg_proto_state_processing_thrift, 'Modernizer'},
{?MODULE, Config}