Allow to specify custom woody event handlers (#111)

This commit is contained in:
Andrew Mayorov 2020-01-28 17:31:03 +03:00 committed by GitHub
parent fa3180948e
commit a378dbc16b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ stop(_State) ->
init(_) -> init(_) ->
{ok, IP} = inet:parse_address(genlib_app:env(?MODULE, ip, "::")), {ok, IP} = inet:parse_address(genlib_app:env(?MODULE, ip, "::")),
HealthCheck = enable_health_logging(genlib_app:env(?MODULE, health_check, #{})), HealthCheck = enable_health_logging(genlib_app:env(?MODULE, health_check, #{})),
EventHandlers = genlib_app:env(?MODULE, woody_event_handlers, [scoper_woody_event_handler]),
API = woody_server:child_spec( API = woody_server:child_spec(
?MODULE, ?MODULE,
#{ #{
@ -32,7 +33,7 @@ init(_) ->
port => genlib_app:env(?MODULE, port, 8022), port => genlib_app:env(?MODULE, port, 8022),
transport_opts => genlib_app:env(?MODULE, transport_opts, #{}), transport_opts => genlib_app:env(?MODULE, transport_opts, #{}),
protocol_opts => genlib_app:env(?MODULE, protocol_opts, #{}), protocol_opts => genlib_app:env(?MODULE, protocol_opts, #{}),
event_handler => scoper_woody_event_handler, event_handler => EventHandlers,
handlers => get_repository_handlers(), handlers => get_repository_handlers(),
additional_routes => [ additional_routes => [
erl_health_handle:get_route(HealthCheck) erl_health_handle:get_route(HealthCheck)