1config(5)                            Files                           config(5)
2
3
4

NAME

6       config - Configuration file.
7

DESCRIPTION

9       A  configuration  file contains values for configuration parameters for
10       the applications in the system. The erl command-line  argument  -config
11       Name  tells  the  system  to  use data in the system configuration file
12       Name.config.
13
14       The erl command-line argument -configfd works the same way as the -con‐
15       fig  option  but specifies a file descriptor to read configuration data
16       from instead of a file.
17
18       The configuration data from configuration files  and  file  descriptors
19       are  read  in the same order as they are given on the command line. For
20       example, erl -config a -configfd 3 -config b -configfd  4  would  cause
21       the  system to read configuration data in the following order a.config,
22       file descriptor 3, b.config, and file descriptor 4. If a  configuration
23       parameter  is  specified more than once in the given files and file de‐
24       scriptors, the last one overrides the previous ones.
25
26       Configuration parameter values in a configuration file or file descrip‐
27       tor override the values in the application resource files (see app(4)).
28       The values in the configuration file are always overridden by  command-
29       line flags (see erts:erl(1)).
30
31       The value of a configuration parameter is retrieved by calling applica‐
32       tion:get_env/1,2.
33

FILE SYNTAX

35       The configuration file is to be called Name.config, where Name  is  any
36       name.
37
38       File  .config  contains a single Erlang term and has the following syn‐
39       tax:
40
41       [{Application1, [{Par11, Val11}, ...]},
42        ...
43        {ApplicationN, [{ParN1, ValN1}, ...]}].
44
45         Application = atom():
46           Application name.
47
48         Par = atom():
49           Name of a configuration parameter.
50
51         Val = term():
52           Value of a configuration parameter.
53

SYS.CONFIG

55       When starting Erlang in embedded mode, it is assumed that  exactly  one
56       system configuration file is used, named sys.config. This file is to be
57       located in $ROOT/releases/Vsn, where $ROOT is the Erlang/OTP  root  in‐
58       stallation directory and Vsn is the release version.
59
60       Release  handling  relies on this assumption. When installing a new re‐
61       lease version, the new sys.config is read and used to update the appli‐
62       cation's configurations.
63
64       This means that specifying another .config file, or more .config files,
65       leads to an inconsistent update of  application  configurations.  There
66       is,  however,  a way to point out other config files from a sys.config.
67       How to do this is described in the next section.
68

INCLUDING FILES FROM SYS.CONFIG AND -CONFIGFD CONFIGURATIONS

70       There is a way to include other configuration files from  a  sys.config
71       file  and  from  a configuration that comes from a file descriptor that
72       has been pointed out with the -configfd command-line argument.
73
74       The syntax for including files can be described by the Erlang type lan‐
75       guage like this:
76
77       [{Application, [{Par, Val}]} | IncludeFile].
78
79         IncludeFile = string():
80           Name of a .config file. The extension .config can be omitted. It is
81           recommended to use absolute paths. If a relative path is used in  a
82           sys.config,   IncludeFile  is  searched,  first,  relative  to  the
83           sys.config directory, then relative to the current  working  direc‐
84           tory  of  the  emulator.  If a relative path is used in a -configfd
85           configuration, IncludeFile is searched, first, relative to the dic‐
86           tionary containing the boot script (see also the -boot command-line
87           argument) for the emulator, then relative to  the  current  working
88           directory of the emulator. This makes it possible to use sys.config
89           for pointing out other .config files in a  release  or  in  a  node
90           started  manually  using  -config or -configfd with the same result
91           whatever the current working directory is.
92
93       When traversing the contents of a sys.config or a -configfd  configura‐
94       tion  and  a  filename is encountered, its contents are read and merged
95       with the result so far. When an application configuration tuple {Appli‐
96       cation,  Env}  is  found,  it is merged with the result so far. Merging
97       means that new parameters are added and existing parameter  values  are
98       overwritten.
99
100       Example:
101
102       sys.config:
103
104       ["/home/user/myconfig1"
105        {myapp,[{par1,val1},{par2,val2}]},
106        "/home/user/myconfig2"].
107
108       myconfig1.config:
109
110       [{myapp,[{par0,val0},{par1,val0},{par2,val0}]}].
111
112       myconfig2.config:
113
114       [{myapp,[{par2,val3},{par3,val4}]}].
115
116       This yields the following environment for myapp:
117
118       [{par0,val0},{par1,val1},{par2,val3},{par3,val4}]
119
120       The  run-time  system  will  abort before staring up if an include file
121       specified in sys.config or a -configfd configuration does not exist, or
122       is  erroneous.  However, installing a new release version will not fail
123       if there is an error while loading an include file, but an  error  mes‐
124       sage is returned and the erroneous file is ignored.
125

SEE ALSO

127       app(4), erts:erl(1), OTP Design Principles
128
129
130
131Ericsson AB                     kernel 8.5.4.2                       config(5)
Impressum