简体   繁体   English

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

[英]What is the “application configuration file” in a rebar3 app?

The inets httpd server docs say, inets httpd 服务器文档说,

The following is to be put in the Erlang node application configuration file to start an HTTP server at application startup:以下是在应用程序启动时要在Erlang节点应用程序配置文件中启动HTTP服务器:

 [{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?在由 rebar3 创建的应用程序中,它在哪里?

The OTP Application docs say, OTP 应用程序文档说,

7.8 Configuring an Application 7.8 配置应用

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:这些是由 .app 文件中的键 env 指定的 {Par,Val} 元组列表:

 {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. Par 是一个原子。 Val is any term. Val 是任何术语。

That seems to suggest that you create environment variables with {Name, Value} tuples.这似乎表明您使用{Name, Value}元组创建环境变量。 However, the required code specified in the httpd server docs does not seem to be in that format.但是,httpd 服务器文档中指定的所需代码似乎不是那种格式。

Just drop this into the sys.config file which is in config folder of your release.只需将其放入 sys.config 文件中,该文件位于您的发行版的 config 文件夹中。 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,
  ['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}]}
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM