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

Richard Carlsson carlsson.richard@REDACTED
Wed Feb 14 11:13:24 CET 2018


Like an operating system, Erlang has several levels. The runtime system
boot stuff assumes very little about standard libraries at all, and what
you're going to do with any flags that don't affect the runtime system
directly. Then the kernel and stdlib basics adds some conventions but still
don't assume too much about overall system behaviour. Then, the application
controller adds conventions about applications and -config (but lets you
have as many config files as you like, with arbitrary names). Then, the
release handler and reltool, if you use them, add further conventions, such
as "you should only have one main config file". (For historical reasons,
you may also find abstraction leaks between these layers.)



        /Richard

2018-02-14 10:24 GMT+01:00 Xavier Noria <fxn@REDACTED>:

> 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).
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180214/09d95737/attachment.htm>


More information about the erlang-questions mailing list