Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

55 linhas
1.5 KiB

%%%-------------------------------------------------------------------
%% @copyright {{copyright_holder}} ({{copyright_year}})
%% @author {{author_name}} <{{author_email}}>
%% @doc {{appid}} OTP application callback module.
%% @end
%%%-------------------------------------------------------------------
-module({{appid}}_app).
-behaviour(application).
-define(APP, {{appid}}).
%% Application callbacks
-export([start/2, stop/1]).
-export([config/0, config/1, config/2,
start/0]).
%%%===================================================================
%%% Convenience Functions
%%%===================================================================
start() ->
application:ensure_all_started(?APP, permanent).
config(Key, Default) ->
case application:get_env(?APP, Key) of
undefined -> Default;
{ok, Val} -> Val
end.
config(Key) ->
case application:get_env(?APP, Key) of
undefined -> erlang:error({missing_config, Key});
{ok, Val} -> Val
end.
config() ->
application:get_all_env(?APP).
%% ===================================================================
%% Application callbacks
%% ===================================================================
start(_StartType, _StartArgs) ->
{{appid}}_sup:start_link().
stop(_State) ->
ok.
%%%===================================================================
%%% Internal functions
%%%===================================================================