extend/cowboy — pull request #265 by saleyn (2012-09-25 17:58:18+00:00)
Title: Added child-spec functions.

Please consider this addition to cowboy. The justification for it is that it allows standard placement of all application-specific child specs including cowboy's into the implementation of the supervisor behaviour's callback AppSupModule:init/1.

E.g.

my_application_sup.erl:

init([]) ->
CDisp = [{'_', [{[], my_cowboy_router, []}]},
CowboySpec = cowboy:http_child_spec(http, 100, [{port, 8080}], [{dispatch, CDisp}]),
MyAppSpec = get_my_app_spec(),
{ok, {{one_for_one, 10, 10}, [CowboySpec, MyAppSpec]}.

In the absence of these exported functions, the implementation is bound to create cowboy child processes in the different (application:start/2) phase of OTP application startup, which is not clean.

Thanks.

Serge