Sha256: 5bcb67d1acb3cedc6d6130b01dcf7ab4518b13922442e7dd15647d5133c8b5d2

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

-module(ernie_server_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).

start_link() ->
  supervisor:start_link({local, ?MODULE}, ?MODULE, []).

init([]) ->
  {ok, Port} = application:get_env(ernie_server_app, port),
  io:format("Using port ~p~n", [Port]),
  {ok, Handler} = application:get_env(ernie_server_app, handler),
  io:format("Using handler ~p~n", [Handler]),
  case application:get_env(ernie_server_app, pidfile) of
    {ok, Location} ->
      Pid = os:getpid(),
      ok = file:write_file(Location, list_to_binary(Pid));
    undefined -> ok
  end,
  {ok, {{one_for_one, 1, 60},
    [{ernie_server, {ernie_server, start_link, [[Port, Handler]]},
    permanent, brutal_kill, worker, [ernie_server]}]}}.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mojombo-ernie-0.1.0 elib/ernie_server_sup.erl