app(4)

NAME
app - Application resource file.

DESCRIPTION

The application resource file specifies the resources an application uses, and how the application is started. There must always be one application resource file for each application in the system.

This file is read by the application controller when an application is loaded. It is also used by the functions in systools when generating start scripts etc.

FILE SYNTAX

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.

The .app file contains one single Erlang term, which is called an application specification. The file has the following syntax:
{application, Application,
  [{description,  Description},
   {vsn,          Vsn},
   {id,           Id},
   {modules,      [Module1, .., ModuleN]},
   {maxT,         MaxT},
   {registered,   [Name1, .., NameN]},
   {applications, [Appl1, .., ApplN]},
   {included_applications, [Appl1, .., ApplN]},
   {env,          [{Par1, Val1}, .., {ParN, ValN}]},
   {mod,          {Module, StartArgs}},
   {start_phases, [{Phase1, PhaseArgs1}, .., {PhaseN, PhaseArgsN}]}]}.

Application = atom() 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, Description}
         Description = string() is a textual description of the application. Defaults to the empty string.

    *   {vsn, Vsn}
         Vsn = string() is the version of the application. Defaults to the empty string.

    *   {id, Id}
         Id = string() is the product identification of the application. Defaults to the empty string.

    *   {modules, Modules}
         Modules = [atom()] is a list of all the modules introduced by this application. systools uses this list when generating start scripts and tar files. A module can only be defined in one application. Defaults to the empty list.

        It is also allowed to list a module as {Module, Vsn}, where Vsn = term(). This has no practical implication, however, as there is no check that Vsn is the same value as the vsn attribute of the module. The format is retained for backwards compatibility only.

    *   {maxT, MaxT}
         MaxT = int() | infinity is the maximum time in milliseconds that the application is allowed to run. After the specified time the application will automatically terminate. Defaults to infinity.

    *   {registered, Registered}
         Registered = [atom()] is a list of all the names of registered processes started in this application. systools uses this list to detect name clashes between different applications. Defaults to the empty list.

    *   {applications, Applications}
         Applications = [atom()] is a list of all the names of applications which must be started before this application is started. systools uses this list to generate correct start scripts. Defaults to the empty list, but note that all applications implemented as supervision trees and all distributed applications have dependencies to (at least) kernel and stdlib.

    *   {included_applications, Applications}
         Applications = [atom()] is a list of all the names of applications which are included by this application. When this application is started, all included application will automatically be loaded, but not started, by the application controller. Processes implemented in an included application should be placed underneath a supervisor in the primary application. Defaults to the empty list.

    *   {env, Env}
         Env = [{Par, Val}], where Par = atom() and Val = term(), is a list of configuration parameters used by the application. The value of a configuration parameter is retrieved by calling 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)). Defaults to the empty list.

    *   {mod, Mod}
         Mod = {Module, StartArgs}, where Module = atom() and StartArgs = term(), specifies the application callback module and the start argument, see application(3).

        The mod key is mandatory for applications implemented as supervision trees, but should be omitted for applications which are code libraries, such as the application STDLIB.

    *   {start_phases, StartPhases}
         StartPhases = [{Phase, PhaseArgs}], where Phase = atom() and PhaseArgs = [term()], is a list of start phases and the attached start arguments for the application. After starting the application, the application master will evaluate the function Mod:start_phase(Phase, Type, PhaseArgs) for each defined start phase, where Mod is the callback module as defined by the mod key. This extended start procedure is intended for synchronized startup of included applications, refer to the chapter about OTP Design Principles for more information. Defaults to undefined.

The following key is no longer used but still allowed (and ignored) to retain backwards compatibility.

    *   {maxP, N}
         N = int() was the maximum number of processes the application was allowed to start. Defaults to infinity.

SEE ALSO

application(3), systools(3)

AUTHORS
Martin Bjorklund - support@erlang.ericsson.se
Gunilla Hugosson - support@erlang.ericsson.se