[erlang-questions] is sys.config mostly a convention?

Xavier Noria fxn@REDACTED
Sat Feb 17 20:09:50 CET 2018


On Sat, Feb 17, 2018 at 7:49 PM, Tristan Sloughter <t@REDACTED> wrote:

It is not a convention. Only with a file named sys.config will the runtime
> read in additional configs you may include within it by name. With
> sys.config you can do:
>
> [{my_app, [...]},
>  "other.config"}].
>

This has already been stated in previous messages, and it is implemented
here
<https://github.com/erlang/otp/blob/7304c1e1deed6ac1fbddc88ea5c6d5138231dbf7/lib/kernel/src/application_controller.erl#L1821>
.

If you look at the code, it says that *if* the basename is "sys.config",
you *can* nest. That is not the same as saying that you need sys.config to
load an application in a release. We have seen some counterexamples, you
can edit the generated shell scripts to load ~/foo.config and it boots just
fine, some tools have support for alternative files, and, definitive, if
you read application_controller.erl you'll see the file is not assumed to
be anywhere.

The release handler is the only piece of code to my knowledge that
critically depends on its existence. If I read its code correctly, if you
want the environment variables merged in an upgrade, sys.config *must* be
located under Vsn. *That* is a requirement, but if you don't do release
upgrades, anything can be passed to -config (which is what generated
scripts do).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180217/3af6ba91/attachment.htm>


More information about the erlang-questions mailing list