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       Configuration parameter values in the configuration file  override  the
15       values  in  the  application resource files (see app(4)). The values in
16       the configuration file can be overridden  by  command-line  flags  (see
17       erts:erl(1)).
18
19       The value of a configuration parameter is retrieved by calling applica‐
20       tion:get_env/1,2.
21

FILE SYNTAX

23       The configuration file is to be called Name.config, where Name  is  any
24       name.
25
26       File  .config  contains a single Erlang term and has the following syn‐
27       tax:
28
29       [{Application1, [{Par11, Val11}, ...]},
30        ...
31        {ApplicationN, [{ParN1, ValN1}, ...]}].
32
33         Application = atom():
34           Application name.
35
36         Par = atom():
37           Name of a configuration parameter.
38
39         Val = term():
40           Value of a configuration parameter.
41

SYS.CONFIG

43       When starting Erlang in embedded mode, it is assumed that  exactly  one
44       system configuration file is used, named sys.config. This file is to be
45       located in $ROOT/releases/Vsn,  where  $ROOT  is  the  Erlang/OTP  root
46       installation directory and Vsn is the release version.
47
48       Release  handling  relies  on  this  assumption.  When installing a new
49       release version, the new sys.config is read  and  used  to  update  the
50       application configurations.
51
52       This means that specifying another .config file, or more .config files,
53       leads to inconsistent update of application configurations.  There  is,
54       however, a syntax for sys.config that allows pointing out other .config
55       files:
56
57       [{Application, [{Par, Val}]} | File].
58
59         File = string():
60           Name of another .config file. Extension .config can be omitted.  It
61           is  recommended  to use absolute paths. If a relative path is used,
62           File is searched, first, relative from sys.config  directory,  then
63           relative  to  the  current  working  directory of the emulator, for
64           backward compatibility. This allow to use a sys.config pointing out
65           other  .config  files  in  a  release or in a node started manually
66           using -config ... with same result  whatever  the  current  working
67           directory.
68
69       When  traversing  the  contents of sys.config and a filename is encoun‐
70       tered, its contents are read and merged with the result so far. When an
71       application  configuration  tuple  {Application,  Env}  is found, it is
72       merged with the result so far. Merging means that  new  parameters  are
73       added and existing parameter values overwritten.
74
75       Example:
76
77       sys.config:
78
79       [{myapp,[{par1,val1},{par2,val2}]},
80        "/home/user/myconfig"].
81
82       myconfig.config:
83
84       [{myapp,[{par2,val3},{par3,val4}]}].
85
86       This yields the following environment for myapp:
87
88       [{par1,val1},{par2,val3},{par3,val4}]
89
90       The  behavior  if  a file specified in sys.config does not exist, or is
91       erroneous, is backwards compatible. Starting the  runtime  system  will
92       fail. Installing a new release version will not fail, but an error mes‐
93       sage is returned and the erroneous file is ignored.
94

SEE ALSO

96       app(4), erts:erl(1), OTP Design Principles
97
98
99
100Ericsson AB                      kernel 6.5.2                        config(5)
Impressum