[erlang-questions] is sys.config mostly a convention?
Xavier Noria
fxn@REDACTED
Wed Feb 14 10:24:57 CET 2018
I have done a walkthrough, and the only thing that I see special-cased is
that sys.config has hard-coded support
<https://github.com/erlang/otp/blob/bf0d03bd6f393b6a4f7836c5203e9a83caf457e8/lib/kernel/src/application_controller.erl#L1821>
for nesting.
One of the first things that the application master does when it starts is
to check `init:get_argument(config)`, which simply lists all the files
passed to `-config` files. The `init/2` function iterates that list and
*If* the basename of one of items is "sys.config", then we enter that `if`
branch. But the implementation does not assume its existence. In
particular, it does not assume its existence regardless of whether the mode
is interactive or embedded (which is said in the config docs).
I confirmed with a sample release, changed the value of `-config` to point
to a dummy foo.config, the system boots normally, and
`init:get_arguments(config)` indeed returns
{:ok, [['/Users/fxn/tmp/sample/_build/prod/rel/sample/foo.config']]}
So my conclusion is that it is really a convention (except for the fact
that the documented nesting does not work in arbitrary config files).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180214/6dcb10dd/attachment.htm>
More information about the erlang-questions
mailing list