erlang rebar3应用程序中的“应用程序配置文件”是什么?

pn9klfpd  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(129)

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.

v1uwarro

v1uwarro1#

只需将其放入sys.config文件中,该文件位于您的发布版本的config文件夹中。如果您已经有了任何内容,则其格式为:

[
 {some_app, [{env_var, value},{...}]},
 {another_app, [{env_var, value},{...}]},
 % add here without outer[]...,
 {kernel,
  [{distributed, [{app_name, 5000,
  ['node@10.0.211.153', 'node_failover@10.8.222.15']}]}, 
  {sync_nodes_mandatory, []},
  {sync_nodes_optional, ['node_failover@10.8.222.15']},
  {sync_nodes_timeout, 5000}]}
]

相关问题