您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

55 行
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
%%%===================================================================