7stud
7stud

Reputation: 48599

What is the "application configuration file" in a rebar3 app?

The inets httpd server docs say,

The following is to be put in the Erlang node application configuration file to start an HTTP server at application startup:

  [{inets, [{services, [{httpd, [{proplist_file,
         "/var/tmp/server_root/conf/8888_props.conf"}]},
        {httpd, [{proplist_file,
         "/var/tmp/server_root/conf/8080_props.conf"}]}]}]}].

Where does that go in an app created by rebar3?

The OTP Application docs say,

7.8 Configuring an Application

An application can be configured using configuration parameters. These are a list of {Par,Val} tuples specified by a key env in the .app file:

{application, ch_app,
 [{description, "Channel allocator"},
  {vsn, "1"},
  {modules, [ch_app, ch_sup, ch3]},
  {registered, [ch3]},
  {applications, [kernel, stdlib, sasl]},
  {mod, {ch_app,[]}},
  {env, [{file, "/usr/local/log"}]}
 ]}.

Par is to be an atom. Val is any term.

That seems to suggest that you create environment variables with {Name, Value} tuples. However, the required code specified in the httpd server docs does not seem to be in that format.

Upvotes: 2

Views: 844

Answers (1)

Roman Rabinovich
Roman Rabinovich

Reputation: 918

Just drop this into the sys.config file which is in config folder of your release. If you have anything there already, it will be in the format of:

[
 {some_app, [{env_var, value},{...}]},
 {another_app, [{env_var, value},{...}]},
 % add here without outer[]...,
 {kernel,
  [{distributed, [{app_name, 5000,
  ['[email protected]', '[email protected]']}]}, 
  {sync_nodes_mandatory, []},
  {sync_nodes_optional, ['[email protected]']},
  {sync_nodes_timeout, 5000}]}
]

Upvotes: 1

Related Questions