简体   繁体   中英

configure proxy in erlang .config file

Usually I do configure the proxy using:

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

Is it possible to achieve the same result using the config file?

Sure you can either use the config file (specified here ) or you can use any .hrl file.

The latter option is the one I use, as you can just

-include("settings.hrl").

in your file. The settings.hrl file might be looking like this

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

And in your code you can then use these defines as follows

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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