github.com/SupersunnySea/draft@v0.16.0/examples/example-erlang/src/draft_example_sup.erl (about) 1 %%%------------------------------------------------------------------- 2 %% @doc draft_example top level supervisor. 3 %% @end 4 %%%------------------------------------------------------------------- 5 6 -module(draft_example_sup). 7 8 -behaviour(supervisor). 9 10 -export([start_link/0]). 11 12 -export([init/1]). 13 14 -define(SERVER, ?MODULE). 15 16 start_link() -> 17 supervisor:start_link({local, ?SERVER}, ?MODULE, []). 18 19 init([]) -> 20 Port = application:get_env(draft_example, http_port, 8080), 21 ElliOpts = [{callback, draft_example_handler}, {port, Port}], 22 23 ElliSpec = #{id => draft_example_server, 24 start => {elli, start_link, [ElliOpts]}, 25 restart => permanent, 26 shutdown => 5000, 27 type => worker, 28 modules => [elli]}, 29 SupFlags = #{strategy => one_for_one, 30 intensity => 5, 31 period => 10}, 32 33 {ok, {SupFlags, [ElliSpec]}}.