erlang / rebar3

Erlang build tool that makes it easy to compile and test Erlang applications and releases.
http://www.rebar3.org
Apache License 2.0
1.69k stars 515 forks source link

rebar3 ignores inets configuration in "shell" mode #2080

Open max-au opened 5 years ago

max-au commented 5 years ago

Same issue as with SSL app in https://github.com/erlang/rebar3/issues/1754 But now it's "inets" application.

When inets configuration is in sys.config:

[ {inets, [ {services, [ {httpd, [ {port, 8080}, {server_name, "erlperf"}, {server_root, "/tmp"}, {document_root, "/tmp/htdocs"}, {bind_address, "localhost"} ]} ]} ]} ].

$ rebar3 shell <...>

inets:services(). [{httpc,<0.102.0>},{httpc,<0.99.0>}] 2> application:get_all_env(inets). [{services,[{httpd,[{port,8080}, {server_name,"erlperf"}, {server_root,"/tmp"}, {document_root,"/tmp/htdocs"}, {bind_address,"localhost"}]}]}] 3>

rebar3 starts inets dynamically, thus ignoring what is in sys.config for the application.

ferd commented 5 years ago

Inets is trickier because we have our own configs to handle deps for r3:compile() commands particularly when the HTTP_PROXY and HTTPS_PROXY is enabled for httpc. You can see it explicitly blacklisted:

https://github.com/erlang/rebar3/blob/3a16cf3763c198e9167ec11a146e25334adc82f5/src/rebar_prv_shell.erl#L422-L427

You can probably take it out to run experiments and see if that would make or break things on your end. If you feel it's workable and won't break functionality, I'm probably fine toggling it out.

max-au commented 5 years ago

I worked it around with inets:stop(), inets:start() in the shell, but it took me a while to find out. Feel free to close if you deem it as desired behaviour (might be worth documenting).

ferd commented 5 years ago

I'm open to either way. Mostly I was afraid of breaking rebar3 functionality, but now that I think about it, it should be possible to stop and restart inets, and reinsert our httpc config. It would maintain current behaviour, but allow fixing non-httpc inets use cases I believe.

schnef commented 4 years ago

I would very much appreciate it if inets could be taken out of the blacklist. That would make using sys.config more consistent and predictable.