The application resource file specifies the resources an
application uses, and how the application is started. There must
always be one application resource file called
Application.app
for each application Application
in
the system.
The file is read by the application controller when an
application is loaded/started. It is also used by the functions in
systools
, for example when generating start scripts.
The application resource file should be called
Application.app
where Application
is the name of
the application. The file should be located in the ebin
directory for the application.
It must contain one single Erlang term, which is called an application specification:
{application, Application, [{description, Description}, {id, Id}, {vsn, Vsn}, {modules, Modules}, {maxP, MaxP}, {maxT, MaxT}, {registered, Names}, {included_applications, Apps}, {applications, Apps}, {env, Env}, {mod, Start}, {start_phases, Phases}]}. Value Default ----- ------- Application atom() - Description string() "" Id string() "" Vsn string() "" Modules [Module] [] MaxP int() infinity MaxT int() infinity Names [Name] [] Apps [App] [] Env [{Par,Val}] [] Start {Module,StartArgs} undefined Phases [{Phase,PhaseArgs}] undefined Module = Name = App = Par = Phase = atom() Val = StartArgs = PhaseArgs = term()
Application
is the name of the application.
For the application controller, all keys are optional. The respective default values are used for any omitted keys.
The functions in systools
require more information. If
they are used, the following keys are mandatory:
description
, vsn
, modules
, registered
and applications
. The other keys are ignored by
systools
.
description
id
vsn
modules
systools
uses this list when generating start scripts and tar files. A
module can only be defined in one application.maxP
maxT
registered
systools
uses this list to detect name
clashes between different applications.included_applications
applications
systools
uses
this list to generate correct start scripts. Defaults to
the empty list, but note that all applications have
dependencies to (at least) kernel
and stdlib
.
env
application:get_env/1,2
. The values in the application
resource file can be overridden by values in a configuration
file (see config(4)
) or by command line flags (see
erl(1)
).mod
application(3)
.mod
key is necessary for an application
implemented as a supervision tree, or the application
controller will not know how to start it. The mod
key
can be omitted for applications without processes, typically
code libraries such as the application STDLIB.start_phases
Module:start/2
- also call
Module:start_phase(Phase,Type,PhaseArgs)
for each
start phase defined by the start_phases
key, and only
after this extended start procedure will
application:start(Application)
return.mod
key must be specified as:{mod, {application_starter,[Module,StartArgs]}}The application master will then call
Module:start/2
for the primary application, followed by calls to
Module:start_phase/3
for each start phase (as defined
for the primary application) both for the primary application
and for each of its included application, for which the start
phase is defined.application(3), systools(3)