繁体   English   中英

在erlang .config文件中配置代理

[英]configure proxy in erlang .config file

通常我会使用以下命令配置代理:

httpc:set_options([{proxy, {{"www-proxy.mycompany.com", 8000},
  ["localhost"]}}]).

使用配置文件可以达到相同的结果吗?

当然,您可以使用配置文件( 在此处指定),也可以使用任何.hrl文件。

后一种选择是我使用的选择,您可以

-include("settings.hrl").

在您的文件中。 settings.hrl文件可能看起来像这样

-define(PORT, 8080).
-define(URL, "http://my.url").

然后,您可以在代码中使用以下定义

httpc:set_options([{proxy, {{?URL, ?PORT}, ["localhost"]}}]).

暂无
暂无

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

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